+ Reply to Thread
Results 1 to 9 of 9

Quitting Excel application(2003) from one of the word(2003) module.

  1. #1
    Registered User
    Join Date
    08-10-2012
    Location
    germany
    MS-Off Ver
    Excel 2003
    Posts
    34

    Quitting Excel application(2003) from one of the word(2003) module.

    HI guys,
    I have this word(2003) template which has one module, one "userForm" and one "ThisDocument" word object(which contains the main codes). The Excel.Application is created in "ThisDocument" and then the rest of the codes run. Some where the code jumps to module 1 and then jumps to "userForm".
    I want to know the syntax or codes that can be used in "userForm" programming section that quits the Excel.Application that was created in "ThisDocument".
    I tried using
    HTML Code: 
    but didnt work.

    Thanks in advance,

    Sam.
    Last edited by samkumar; 09-05-2012 at 03:32 AM.

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Quitting Excel application(2003) from one of the word(2003) module.

    if you have a variable holding the reference to the excel application then it's
    variable_name.quit
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Registered User
    Join Date
    08-10-2012
    Location
    germany
    MS-Off Ver
    Excel 2003
    Posts
    34

    Re: Quitting Excel application(2003) from one of the word(2003) module.

    Hi JP,

    The object variable holding the refernce to the Excel application is oXL which is in "ThisDocument" editor window. I want Excel application to quit from "userForm" editor window.

    Sam

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Quitting Excel application(2003) from one of the word(2003) module.

    if oXL is declared as Public in the ThisDocument module then
    Please Login or Register  to view this content.
    oughta do it.

  5. #5
    Registered User
    Join Date
    08-10-2012
    Location
    germany
    MS-Off Ver
    Excel 2003
    Posts
    34

    Re: Quitting Excel application(2003) from one of the word(2003) module.

    exactly!! i did the same thing. i declared oXL as public in "ThisDocument" module and then i used the code
    Please Login or Register  to view this content.
    in "userForm" module. An error message appears saying "object variable or with-block variable not specified/defined"

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Quitting Excel application(2003) from one of the word(2003) module.

    then I guess you haven't run the code to initialize the variable or you have subsequently set it to nothing

  7. #7
    Registered User
    Join Date
    08-10-2012
    Location
    germany
    MS-Off Ver
    Excel 2003
    Posts
    34

    Re: Quitting Excel application(2003) from one of the word(2003) module.

    I havent set it to nothing anywhere in between. could there be any other mistakes? or should i use "with"

    Sam.

  8. #8
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Quitting Excel application(2003) from one of the word(2003) module.

    how would 'with' help you? if there's no object reference set, you can't hold a reference to it with 'with' ;-)
    I reckon we need to see all the code or preferably the document

  9. #9
    Registered User
    Join Date
    08-10-2012
    Location
    germany
    MS-Off Ver
    Excel 2003
    Posts
    34

    Re: Quitting Excel application(2003) from one of the word(2003) module.

    i meant fo example :
    Please Login or Register  to view this content.
    It doesnt seem to work.

    I then tranferred all the codes from "ThisDocument" module to a new module(module2) and then i used the codes
    Please Login or Register  to view this content.
    it seems to work. But then the command buttons on the word template trigger the macros only when the codes are in "ThisDocument" module.

    I am not allowed to show the document because it violates my employers rules(hope you understand)..

    Sam

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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