Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-28-2012, 01:36 AM
macropod's Avatar
macropod macropod is offline Saveas error handling Windows 7 64bit Saveas error handling Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

I think there's an error in your code. I believe:
"Care Plan System\"
should be:
"\Care Plan System\"
You probably also don't need:
ChangeFileOpenDirectory "M:\Care Plan System\"


which can be replaced by:
myfilename = "M:\Care Plan System\Care Plan System\" + myfilename
There also doesn't seem to be any point in having '& myfilename' in:
InputBox("Enter file name for document " & myfilename)
as 'myfilename' is empty when the InputBox runs.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #2  
Old 03-28-2012, 03:13 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

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
Reply



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 06:19 PM.


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