Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    Sep 2003
    Location
    Toronto, Ontario, Canada
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Activate Excel From Word (Excel/Word 2000)

    My Word (2000) macro creates labels by merging an Excel spreadsheet (data source) with a Word main document. It runs successfully, with the finished labels on the screen and the main document and the data source both closed. The only problem is that Excel prompts the user with the Save/Don

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Activate Excel From Word (Excel/Word 2000)

    Are you using Automation to open the data source, i.e., declaring an Excel.Application object? If so, you shouldn't have to activate the window, you should be able to close it directly. If Word is opening the data source itself as part of the merge, you still could try to get a reference to the worksheet using GetObject, but if there are multiple Excel windows, it gets tricky.

  3. #3
    Star Lounger
    Join Date
    Sep 2003
    Location
    Toronto, Ontario, Canada
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Activate Excel From Word (Excel/Word 2000)

    "Tricky"'s the word. I'd use GetObject to open the spreadsheet in the first place, but would the Word mergetonewdocument not simply re-open it?

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Activate Excel From Word (Excel/Word 2000)

    I truly have no idea, sorry. Hardly do any merges, and never via VBA.

  5. #5
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Activate Excel From Word (Excel/Word 2000)

    Using GetObject, something like the following should work :<pre> Dim xlWB
    Set xlWB = GetObject("PathFileName.xls")
    'Do Process
    xlWB.Close 0
    Set xl = Nothing</pre>

    What changes are being made to the workbook that would render it in need of saving ?

    Is it necessary to open the workbook to perform a mailmerge from it ?

    Andrew C

  6. #6
    Star Lounger
    Join Date
    Sep 2003
    Location
    Toronto, Ontario, Canada
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Activate Excel From Word (Excel/Word 2000)

    Andrew Cronnolly,
    Thank you for responding to my post.
    But I made another change that seems to have fixed the problem.
    Let me tell you what I was doing. The user types a list of customer numbers in a column in Excel and runs an Excel macro to extract name and address information from a database. The macro names the file and its path on the user

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •