-
Certainly the line:
wdApp.Documents.Open(saveString).Close
is wrong. You have an Open and Close in the same instruction.
Make an Document object of the current document, and then save and close it.
You ignored the comment I made in your previous post about creating the Word instance each time. I will repeat...this is a BAD idea.
I will also say it again, using the Dialog seems - at least as far as I can tell - not a good idea either. Why are you doing that?
I have no idea where you are getting saveString. Your code does not show this. In any case, if you want to save the current active document with a name, then (assuming it IS the Document object wdDoc, AND "saveString" is a properly qualified path and name...)[vba]
With wdDoc
.SaveAs Filename:=saveString
.Close
End With
' destroy current Document object
Set wdDoc = Nothing
' the above means you can use wdDoc again
' Set as a new document
[/vba]
As I mentioned previously, if you are indeed going through multiple documents you can make each of them a Document object (wdDoc - Set...used...Closed...Destroyed...Set again). AND you can do this with ONE instance of Word (wdApp). You do not need to make a new instance of Word each time. In fact, again, it is a BAD idea to do that.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules