Results 1 to 2 of 2
  1. #1
    Plutonium Lounger
    Join Date
    Nov 2001
    Thanked 7 Times in 7 Posts

    Re: Automation w/ Excel (Word 2002)

    How about closing the workbook before you set wbk to Nothing.


    I just reread your post and noticed the .Close(True), sorry I had missed it first time round. Time to think again.

  2. #2
    2 Star Lounger
    Join Date
    Feb 2010
    Denver, CO
    Thanked 0 Times in 0 Posts

    Automation w/ Excel (Word 2002)

    I have created a Word document with a linked Excel chart. There is code that updates the data for the chart automatically. After I run this code within Word, the excel file that contained the data and the chart is no longer accessible. I cannot open it for further editing. Interestingly, though, running the apparently offending macro in Word still accesses the Excel chart and updates the data like it is suppose to. How weird is that?? Is there something else I should have done in order to release that file?

    Here is the code I ended up with:
    <hr>Private Sub Document_Open()

    Dim wbk As Object

    Set wbk = GetObject("C:test1.xls")
    With wbk
    .Close (True)
    End With

    Set wbk = Nothing
    End Sub<hr>

Posting Permissions

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