Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-27-2012, 02:30 AM
jillapass jillapass is offline Saveas error handling Windows 7 32bit Saveas error handling Office 2007
Novice
Saveas error handling
 
Join Date: Dec 2011
Posts: 26
jillapass is on a distinguished road
Default Saveas error handling

I have 2 buttons in a word document for saving, the document is an dotm which runs various macros depending on what the user inputs.

The first button is labelled 'Save as Working Document' and this simply asks the user to choose a filename and saves it as a dotm and works fine.

The second button is 'Save as Final Document' which needs to be a docx.

This second one fails, the only difference is the fileformat part of the statement.



I think I know what the problem is, but don't know what to do. If I save the document manually to a docx format it warns me that I will lose my VBA macros, but that is what I actually want.

So, my question is how do I tell the macro that I don't mind that.

This is the code.
Code:
Private Sub Savetemplate1_Click()
ChangeFileOpenDirectory "M:\Care Plan System\"
Dim myotherfilename As String
Dim myfilename As String
myotherfilename = Options.DefaultFilePath(wdDocumentsPath)
myfilename = InputBox("Enter file name for document " & myfilename)
'MsgBox myfilename
myfilename = myotherfilename + "Care Plan System\" + myfilename
MsgBox myfilename
'ActiveDocument.SaveAs FileName:=myfilename, FileFormat:=wdFormatXMLTemplateMacroEnabled
 
ActiveDocument.SaveAs FileName:=myfilename, _
FileFormat:=wdFormatXMLDocument
 
End Sub
The first Saveas is commented, but is just there to show what the code is like that works.

Last edited by macropod; 03-27-2012 at 10:32 PM. Reason: Added code tags
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Saveas error handling Microsoft office 2010 error 2908 and error 1935 !!!!!!heeeeellpppp!!!!!!!!! bennypryde Office 1 01-05-2012 03:33 PM
Saveas error handling saveAs ChDir _ tinfanide Excel Programming 4 11-05-2011 01:40 AM
Handling Excel Data msofficeno475 Excel 1 01-17-2010 09:56 AM
Runtime error 5487 - Word cannot complete the save to to file permission error franferns Word 0 11-25-2009 05:35 AM
Handling ICALENDAR attachments l_kris06 Outlook 0 11-12-2008 07:22 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:17 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft