Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-28-2012, 04:12 AM
macropod's Avatar
macropod macropod is online now Saveas error handling Windows 7 64bit Saveas error handling Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,512
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 have no trouble running the code like:
Code:
Private Sub Savetemplate1_Click()
Dim myotherfilename As String, myfilename As String
ChangeFileOpenDirectory "M:\Care Plan System\"
myotherfilename = Options.DefaultFilePath(wdDocumentsPath)
myfilename = InputBox("Enter file name for document " & myfilename)
myfilename = myotherfilename + "\Care Plan System\" + myfilename
ActiveDocument.SaveAs FileName:=myfilename, FileFormat:=wdFormatXMLTemplateMacroEnabled
Application.DisplayAlerts = False
ActiveDocument.SaveAs FileName:=myfilename, FileFormat:=wdFormatXMLDocument
Application.DisplayAlerts = True
End Sub
The only differences for my system are that I need to use what for me is a valid ChangeFileOpenDirectory path and that, instead of "\Care Plan System\" I use "\".

Something I have noticed, though, is that you're using ChangeFileOpenDirectory before storing wdDocumentsPath. That means the wdDocumentsPath = "M:\Care Plan System\". Perhaps you need to reverse the order of these statements, because what you're getting now is, in effect:
myfilename = "M:\Care Plan System\Care Plan System\" + myfilename
It seems strange that you'd have a subfolder with the same name as its parent.

Also, having stored wdDocumentsPath in myotherfilename, you don't ever restore it:
Options.DefaultFilePath(wdDocumentsPath) = myotherfilename


Of course, that would be futile at the moment, because of the order in which you're using ChangeFileOpenDirectory and storing wdDocumentsPath.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #2  
Old 03-28-2012, 05:06 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
You are being so helpful and yet I still cannot get mine to work.
I have gone back to basics and created a macro by recording the steps I am taking.

Here is the very simple bit of code, no filenames being input or anything, and yet it still fails for me.

Code:
Private Sub CommandButton1_Click()
    
    ActiveDocument.SaveAs FileName:="M:\Care Plan System\testdoc 1259.docx", _
        FileFormat:=wdFormatXMLDocument, LockComments:=False, Password:="", _
        AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, _
        EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData _
        :=False, SaveAsAOCELetter:=False
End Sub
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 11:58 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