Results 1 to 6 of 6
  1. #1
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Dallas, Texas, USA
    Posts
    1,680
    Thanks
    0
    Thanked 1 Time in 1 Post

    ThisWorkbook Object (XL2000 VBA)

    Is there a way to initiate new code placed in the ThisWorkbook object other than closing and re-opening the file?

    Secondly, Whenever I click on an excel file from My Documents, it will not open. Excel will open but with error messages about the file being moved (it hasn't!). If I use the Open command from within excel, the file will open without complications. What have I messed up, now?
    - Ricky

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: ThisWorkbook Object (XL2000 VBA)

    1. There are a large number of events beyond Workbook_Open() and Workbook_BeforeClose, such as Workbook_Activate & Workbook_Deactivate, all listed in the right hand drop down of the This Workbook Workbook object in the VBE code window. See if one of those Events will do what you need.

    2. Check to see if Tools, Options, General, Settings area, Ignore Other Apps is checked, if so uncheck it.
    -John ... I float in liquid gardens
    UTC -7ąDS

  3. #3
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Dallas, Texas, USA
    Posts
    1,680
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: ThisWorkbook Object (XL2000 VBA)

    The solution to #2 worked - thanks.

    I think I asked the 1st question wrong?? I just added new code to the ThisWorkbook object that sets the scrollarea for one of the sheets. I would like for that scrollarea to take effect NOW without having to close the file and reopen it - just trying to save some time and check/test the code. Having to open and close the file after each new line of code will take me all night!
    - Ricky

  4. #4
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ThisWorkbook Object (XL2000 VBA)

    Can you just run it? Position your cusror inside the routine and press F5?
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  5. #5
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Dallas, Texas, USA
    Posts
    1,680
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: ThisWorkbook Object (XL2000 VBA)

    Yes - that worked. I should've known that but I've always just closed it up and restarted again. Does it run from the position where you place the cursor or does it run the entire sub from which you place the cursor into?
    - Ricky

  6. #6
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ThisWorkbook Object (XL2000 VBA)

    It runs the whole routine. If your cursor is in a function or a sub with parameters, it doesn't run that routine.

    You can use the dubgging to stop at a point or to skip over statements.

    You can also run an individual statement from the "Immediate" window.
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

Posting Permissions

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