Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File Save As

Status
Not open for further replies.

eagleclaw

Programmer
Sep 20, 2002
19
US
I have captured the fileSave as Menu so I can run a naming macro. The problem I have is that If I have two Documents Open and I save, The First File is saved with the new file name. for instance if I have Doc1 and doc2 and do a save as on doc2 with the name set as doc3. Doc1 is saved under the newFile name. Here is my code


Dim menuname, varFileName, docType As String
Dim fd As FileDialog
Dim frmDiag As Dialog
Dim propDiag As Dialog

Dim docFirst As Document
Set docFirst = Documents.Item(1)


If docType <> &quot;&quot; Then
NameDoc (docType)
End If
menuname = CommandBars(1).Name
CommandBars(&quot;file&quot;).Controls(&quot;Properties&quot;).Execute
menuname = CommandBars(1).Name
'Overrides the File Save As and displays the FileDialog Form

If strLeafCode = &quot;&quot; Then
strLeafCode = &quot;Letter&quot;
End If
NameDoc (strLeafCode)
Set fd = Application.FileDialog(msoFileDialogSaveAs)
fd.InitialFileName = strNewFileName
fd.Show
fd.Execute

End Sub

Any Ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top