Results 1 to 12 of 12
  1. #1
    4 Star Lounger
    Join Date
    Jul 2006
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    spreadsheet opening when running macro (2003)

    For some odd reason a spreadsheet is opening every time l run any macro (this is called gina.xls).

    Is there any way to prevent this from happening?
    Attached Images Attached Images

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: spreadsheet opening when running macro (2003)

    Any macro from any workbook?
    How do you start these macros?
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  3. #3
    4 Star Lounger
    Join Date
    Jul 2006
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: spreadsheet opening when running macro (2003)

    Yes, any workbook from any macro.

    I start the macro by clicking on the button, see screenshot.
    Attached Images Attached Images

  4. #4
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: spreadsheet opening when running macro (2003)

    My guess is that the macros are actually stored in gina.xls and that the toolbar buttons your screenshot shows point to macros in gina.xls.

    If you have a toolbar with buttons pointing to a certain file and you open that file and save it under a new name, the toolbar buttons will now point to the new file.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  5. #5
    4 Star Lounger
    Join Date
    Jul 2006
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: spreadsheet opening when running macro (2003)

    Each macro needs to work on a certain file, how do l assign a file to a macro?

  6. #6
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: spreadsheet opening when running macro (2003)

    You don't, you write the VBA in such a way that it either operates on things like activeworkbook or on a specific workbook (e.g.one you let the user find on the drive and then have your code open).

    What I was referring to is that the toolbar buttons are tied to a macro that is stored in a workbook (in this case the file that opens each time you click a button).
    To see what macro is attached to a button, rightclick the button and choose Customise. Then rightclick the same button again and choose "Assign macro". You'll get a dialog screen that shows to what macro in what file the button is attached.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  7. #7
    4 Star Lounger
    Join Date
    Jul 2006
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: spreadsheet opening when running macro (2003)

    You don't, you write the VBA in such a way that it either operates on things like activeworkbook or on a specific workbook (e.g.one you let the user find on the drive and then have your code open). - How do l do this?

  8. #8
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: spreadsheet opening when running macro (2003)

    > How do l do this?

    When you write your code you tell it what to do, with instructions like
    <code>Workbooks.Open("C:MyFolderGINA.XLS")</code>
    or
    <code>ActiveWorkbook.Save</code>

    etc,

    StuartR

  9. #9
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: spreadsheet opening when running macro (2003)

    If you record a very small new macro; then ensure that Gina.xls is closed; then run the new macro. Does Gina.xls open?
    Regards
    Don

  10. #10
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: spreadsheet opening when running macro (2003)

    If you show us one of the macros then we may help adapting the code to your needs.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  11. #11
    4 Star Lounger
    Join Date
    Jul 2006
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: spreadsheet opening when running macro (2003)

    I think l have worked out what the problem, that is the macro was recorded when Gina.xls was open.
    I will get them to re-do the macro but this time not open file Gina.xls file. Thanks for your help.

  12. #12
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: spreadsheet opening when running macro (2003)

    This can mean any number of things:

    1 The toolbar (menu) buttons point to the macro, which is in gina.xls
    2 The macro opens gina.xls because that was one of the things they did whilst recording the macro
    - ...

    In case 1 the code is there, but in gina.xls (you can copy and paste code elsewhere)
    In case 2 you need to edit the VBA code and remove the statement that opens gina:
    Workbooks.Open "Gina.xls"
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

Posting Permissions

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