Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Aug 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Word controlling Excel (Word XP VBA)

    I have a form in word that allows users to put a digital signature in a document. However, in order to do this they need to enter a username and password. These are then checked with a permissions table in Excel. It all works perfectly except when I look in task manager, the instance of Excel is not being closed. If I exit word, or run the code and hit reset, Excel closes. Can I get this to happen as part of the code? PLEASE?

    Attached is word doc showing the code...

    Thanks

  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: Word controlling Excel (Word XP VBA)

    <hr><code> 'xlap.Quit</code><hr>
    I assume this was commented out for testing, and there is a place where you actually Quit Excel?

  3. #3
    New Lounger
    Join Date
    Aug 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word controlling Excel (Word XP VBA)

    Hi
    Yes, there are a few instances of xlap.quit that are commented out! It is actually done at the end in the case statements...

    It doesn't seem to matter where I put it though, excel is still left running. My thinking is that if i can reset the module maybe this will work? Is this possible?

    Thanks

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Word controlling Excel (Word XP VBA)

    The lines

    Set mybook = Excel.Application.Workbooks.Open(mytable)

    and

    Set myRange = Excel.Range("WileyList")

    are probably the culprits - they refer to Excel without referring to the xlap object you created. Change them to

    Set mybook = xlap.Workbooks.Open(mytable)

    and

    Set myRange = xlap.Range("WileyList")

    By the way, since xlap is an Excel.Application object, you can change

    xlap.Application.Quit

    to

    xlap.Quit

  5. #5
    New Lounger
    Join Date
    Aug 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word controlling Excel (Word XP VBA)

    Thanks Hans

    But I am afraid that this still leaves the instance of Excel running, still visible in task manager... My temporary solution is to force word to save and close when the process is complete, but any other ideas would be greatly appreciated...

    Regards
    Ian

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Word controlling Excel (Word XP VBA)

    Try the attached version of the code. I added an error and exit handling section, added missing declarations, and cleaned up the code a bit.

Posting Permissions

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