ReportSmithing
Programmer
Currently, I have a VB App that calls a Word document using the shell command, once the Word doc is opened, I poke data into bookmarks on that Word doc and then I use a DDE Execute command from VB to run the "SaveMeToTemp" macro located in my Word doc.
I'm not very experienced at Word, so today by mistake I accidently erased my macro! And of course I can't find the same macro on the internet where I found it in the first place!
My goal here is to have the Word doc macro run and the Word document save automatically to C:\TEMP - I want to totally change the path name from it's original location. The below code (my feeble attempt) doesn't work very well - it will save the document to the desired location, but the active document still resides in the original location from where I opened it. Could someone help me to have the active path name change to C:\TEMP also?
Sub SaveMeToTemp()
Dim strFileA, strFileB, strFileC
ActiveDocument.Save
strFileA = ActiveDocument.Name
strFileB = "C:\TEMP\" & Format(Date, "yyyy-mm-dd") & "_" & Format(Time, "hh-mm-ss") & "_" & strFileA
strFileC = ActiveDocument.FullName
ActiveDocument.SaveAs FileName:=strFileB
ActiveDocument.SaveAs FileName:=strFileC
End Sub
Thanks for you help.
I'm not very experienced at Word, so today by mistake I accidently erased my macro! And of course I can't find the same macro on the internet where I found it in the first place!
My goal here is to have the Word doc macro run and the Word document save automatically to C:\TEMP - I want to totally change the path name from it's original location. The below code (my feeble attempt) doesn't work very well - it will save the document to the desired location, but the active document still resides in the original location from where I opened it. Could someone help me to have the active path name change to C:\TEMP also?
Sub SaveMeToTemp()
Dim strFileA, strFileB, strFileC
ActiveDocument.Save
strFileA = ActiveDocument.Name
strFileB = "C:\TEMP\" & Format(Date, "yyyy-mm-dd") & "_" & Format(Time, "hh-mm-ss") & "_" & strFileA
strFileC = ActiveDocument.FullName
ActiveDocument.SaveAs FileName:=strFileB
ActiveDocument.SaveAs FileName:=strFileC
End Sub
Thanks for you help.