file Save and Save As question

L

lik

I have a macro set to auto fill in the file name when a user clicks save or
save/as. Right now multiple open and save/saveas of the documents will
always use my prefilled info I have defined in the macro. If a user
overrides my default and saves the document. The next time they open the
doucment and click on save or save-as, how do I code to use what they named
it rather than my default. Im probably not making myself clear, so here is
an example;

My code for save is
Sub FileSave()
With Dialogs(wddialogfilesaveas)
..Name = "TP" & ActiveDocument.FormFields("rfacurrent").Result
..Show

End With

End Sub

User sees the auto fill in of TP123456.doc as the file name. They change
it to be saved as
TP123456automaticcomm.doc. It saves the document as
TP123456automaticcomm.doc. BUT the next time they open the document to make
changes, and save it, it changes back to TP23456.doc, and they ahve to
retype the tp123456automaticcomm.docr . How can I tell it to save as
TP123456automaticcommdoc the second + times they save the document?

Thanks,
Linda
 
E

Ed

A new blank document should have a name of "Document" & number. If your
users are working with new blank documents that have never been named
before, you should be able to wrap your naming code in an If statement:

Dim strFName As String
strFName = ActiveDocument.Name
If Left(strFName, 3) = "Doc" Then
' your naming code
End If

HTH
Ed
 
H

Helmut Weber

Hi Linda,
---
Dim sName As String
With ActiveDocument
sName = .FormFields("rfacurrent").Result
sName = "TP" & sName
sName = sName & "automaticcomm.doc"
With Dialogs(wdDialogFileSaveAs)
.Name = sName
.Show
End With
End With
---
Why not saving the doc always as sName,
so that no user has to type anything at all?

Greetings from Bavaria, Germany

Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top