#1
|
|||
|
|||
SaveAs problem
I can't seem to do a saveas, saveas2, or save without the saveas dialog coming up. I've got it down to some pretty simple code that repros the problem every time.
Sub TestSaveAs() Const FILE_TO_OPEN = "c:\temp\testopen.docx" Const FILE_TO_SAVE = "c:\temp\testsave.docx" Dim wd As Word.Document Set wd = Word.Documents.Open(FILE_TO_OPEN) wd.SaveAs2 FILE_TO_SAVE wd.Close False End Sub It never reaches the wd.close command unless I do an on error resume next. This only started happening recently, about the same time my machine was automatically upgraded to Office 2016. Doesn't happen in Excel, unless I create a Word object and use the Word's SaveAs2 method. I've rebooted, rolled back (but not before Office 2016, as the restore point is no longer available), and everything else I could think of. Very frustrated. :-( |
#2
|
|||
|
|||
I moved my docm file to another computer, that has Office 2013, and had the same problem. Makes me think this is by design, but I don't understand why? If so, does anyone have a workaround? I need to open thousands of documents, one at a time, do some processing on them, and save them back to a different location, but I can't have it prompt me to do a saveas for each file. Note, too, that the saveas dialog always defaults to the folder I opened the document from, rather than the path I specified in the SaveAs2 parameters. The example above goes to the same folder for simplicity sake, but my actual requirement is to save to a different folder. Thus, not only do I have to click the ok button for every file, I also have to navigate to the correct folder.
Something else I didn't mention before. After I manually save to the new location using the saveas dialog, the save completes, but my program crashes with a "Run-time error '4198': Command Failed" error and my code never closes the document. |
#3
|
||||
|
||||
Have you tried repairing the Office installation (via Start > Windows Control Panel > Programs > Programs & Features > Microsoft Office (version) > Change > Repair)?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#4
|
||||
|
||||
Some add-ins can affect the behaviour of SaveAs - check your add-ins.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#5
|
|||
|
|||
Quote:
Has anyone else tried running my sample code to see if they experience the same behavior? |
#6
|
|||
|
|||
Solved
Quote:
The Addin was one added by Acer to save my documents to the AcerCloud. I had no idea my documents were being uploaded to their cloud. BTW, I love your website, I've added it to my favorites. Thanks! |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
SaveAs FileFormat | ch1325 | Excel Programming | 8 | 04-11-2016 04:24 PM |
SaveAs Doesn't work | royersebastien | Word VBA | 0 | 03-23-2016 01:29 AM |
VBS saveas API behaviour is different from Menu saveas | Ahmed AbuZekry | Word VBA | 2 | 03-23-2015 02:14 AM |
How to suppress saveas dialog from VB6 | steveneashcraft | Word VBA | 15 | 05-09-2014 07:01 AM |
saveAs ChDir _ | tinfanide | Excel Programming | 4 | 11-05-2011 01:40 AM |