+ Reply to Thread
Results 1 to 2 of 2

VBA Word Application SaveAs pathname (defined in Excel 2003) error

  1. #1
    Registered User
    Join Date
    09-19-2011
    Location
    Hong Kong, Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    1

    VBA Word Application SaveAs pathname (defined in Excel 2003) error

    Hi all,

    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")
    Else
    Set wdApp = New Word.Application
    End If
    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!

  2. #2
    Forum Contributor
    Join Date
    12-28-2011
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    280

    Re: VBA Word Application SaveAs pathname (defined in Excel 2003) error

    What error do you get and which line is highlighted?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • 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