Save renamed file to original directory

RaymondB
NewLounger
Posts: 9
Joined: 15 Dec 2020, 13:23

Save renamed file to original directory

Post by RaymondB »

Good morning once again.

I have a user form which asks the user if they wish to change any of the parameters of a file name and if so changes the file name and prompts to save it.

The format of the file name is ""Product_Name" SectionName Version "Version_No" "Effective_Year""Effective_Month""Effective_Day".docx"

For example "product 1 Section Incoming mail Version 06 20200815.docx"

The user would, for example, change the version number and effective month and day.

For example "product 1 Section Incoming mail Version 06 20200815" becomes "product 1 Section Incoming mail Version 07 20210916".

This is all good and well but word prompts the user (via the SaveAs dialog) to save the renamed file in his default file location whereas it must be saved in the location from which the original file was opened. The user has to then navigate. Depending on the file, it could be as many as 3 folders down on a shared directory.

How do I go about getting the dialog to prompt to the original location?

Any help will, as usual, be greatly appreciated.

Raymond Basson

User avatar
HansV
Administrator
Posts: 78439
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Save renamed file to original directory

Post by HansV »

What is the code that prompts the user to save?
Best wishes,
Hans

RaymondB
NewLounger
Posts: 9
Joined: 15 Dec 2020, 13:23

Re: Save renamed file to original directory

Post by RaymondB »

MySaveName = "multisure" & " " & Section.GetText & " Version " & Version.GetText & " " & VersionYear.GetText & VersionMonth.GetText & VersionDay.GetText & ".docx"
With Dialogs(wdDialogFileSaveAs)
.Name = MySaveName

.Show
End With
FileSave

User avatar
HansV
Administrator
Posts: 78439
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Save renamed file to original directory

Post by HansV »

Use

MySaveName = ActiveDocument.Path & "\" & "multisure" ...
Best wishes,
Hans

RaymondB
NewLounger
Posts: 9
Joined: 15 Dec 2020, 13:23

Re: Save renamed file to original directory

Post by RaymondB »

Thanks, I will try it later.

RaymondB
NewLounger
Posts: 9
Joined: 15 Dec 2020, 13:23

Re: Save renamed file to original directory

Post by RaymondB »

Thanks, works like a charm