VBA Word Application SaveAs pathname (defined in Excel 2003) error
This error is blowing my mind at the moment. The basic gist is that, launching from Excel, I am using a word doc as a template with bookmarks to be populated with data from Excel. My problem is when I go to name and save the file with a custom pathname, it won't take. (though copying the exact same code and assigning to fill a blank cell works just fine). Currently it is like such:
If IsAppRunning("Word.Application") = True Then
Set wdApp = GetObject(, "Word.Application")
Set wdApp = New Word.Application
wdApp.Visible = True
Set myDoc = wdApp.Documents.Open("H:\Document Template.doc")
**** omitting bookmark code, as problem isn't there****
myDoc.SaveAs FileName:=("H:\Email Docs\" & Year(Cells.Find("Date").Offset(1, 0)) & "\" & _
Cells.Find("Code").Offset(1, 0) & " " & Cells.Find("Index").Offset(1, 0) & " " & _
Format(Cells.Find("DateTime").Offset(1, 0), "dd mmm") & ".doc")
Debugging, when I assign a new variable the same code, the pathname is appearing/populating properly from the other cells. Also, if I manually enter the same text that the formula puts together, it also works. I just don't know why my instance of the Word Application is not letting me save.
Would deeply appreciate help, I can't figure it out!
Re: VBA Word Application SaveAs pathname (defined in Excel 2003) error
What error do you get and which line is highlighted?
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Search Engine Friendly URLs by vBSEO 3.6.0 RC 1