Thread: [Solved] Saveas error handling
View Single Post
 
Old 03-28-2012, 03:13 AM
jillapass jillapass is offline Windows 7 32bit Office 2007
Novice
 
Join Date: Dec 2011
Posts: 26
jillapass is on a distinguished road
Default

Hello Paul

I have now made my code literally a few lines as show at the end as all the rest is just localisation. But, it still fails on the 2nd save wiht run-time error 4198: command failed.

I have to admit I am getting a bit frustrated now.
What I am trying to do is save a .dotm word template as a .docx using the name that the user enters, but I just don't seem to be able to achieve it. At the moment the users have to press save as and select word document, but this seems beyond their very limited ability which is why I thought I would automate it. I also need to keep a .dotm version in case they need to make changes at a later date.



myfilename = InputBox("Enter file name for document " & myfilename)
MsgBox myfilename '(this is just for me to see what I have entered)
ActiveDocument.SaveAs FileName:=myfilename, FileFormat:=wdFormatXMLTemplateMacroEnabled
Application.DisplayAlerts = False
ActiveDocument.SaveAs FileName:=myfilename, FileFormat:=wdFormatXMLDocument
Application.DisplayAlerts = True
Reply With Quote