Default Filename

M

MartinG

This is a macro sitting in a Word template. The template is linked to an extract that is dowloaded from another system. The download is produced over and over again with new data each time. The macro undo the links and therefore I want to avoid that the template by mistake is saved without links.

The Macro below works, however I want to display a different filename to the default Word is providing.

Please help..........

Sub Browse_Save_and_Undo_Links()

Application.ScreenUpdating = False

If Dialogs(wdDialogFileSaveAs).Show = 0 Then
GoTo A ' If user presses cancel
Else
Selection.WholeStory
Selection.Fields.Update
Selection.Fields.Unlink
Selection.HomeKey Unit:=wdStory
ActiveDocument.Save
End If

Application.ScreenUpdating = True

A:

End Sub
 
J

Jonathan West

Hi Martin,

Change it this way

Sub Browse_Save_and_Undo_Links()

Application.ScreenUpdating = False

With Dialogs(wdDialogFileSaveAs)
.Name = "my filename.doc" 'make this whatever you want
If .Show = 0 Then
Application.ScreenUpdating = True
Exit Sub
Else
Selection.WholeStory
Selection.Fields.Update
Selection.Fields.Unlink
Selection.HomeKey Unit:=wdStory
ActiveDocument.Save
End If

Application.ScreenUpdating = True
End With

End Sub


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup


MartinG said:
This is a macro sitting in a Word template. The template is linked to an
extract that is dowloaded from another system. The download is produced over
and over again with new data each time. The macro undo the links and
therefore I want to avoid that the template by mistake is saved without
links.
 

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