dcsimg
Results 1 to 8 of 8

Thread: Global Macro Problem

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2005
    Posts
    48

    Global Macro Problem

    Hey,

    I am having a problem.

    I would like to record a macro that i can run through a VB.NET app, but how do I create global macros with excel? I did it with word once and it worked fine.

    Basically, I am creating new excel files with this program, and I then want to open up this excel file and run a macro on it, but it is a brand new excel file and has no macros.

    Is there any way to create global macros in excel?

    Thanks,

    - Josh

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Global Macro Problem

    Silly question but if you are running a macro that is doing formatting or setting up sheets or something, why not have it in you app too, so it creates a new workbook/sheet and does what it needs to?

    Or are the macros for later use, in which case, you can (with difficulty) write code into the worksheets or you could create a template workbook and copy/use that when creating new workbooks.

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2005
    Posts
    48

    Re: Global Macro Problem

    The data is in the file, and the file is closed when I need to open the file back up and run the macro.

  4. #4
    Lively Member
    Join Date
    Apr 2005
    Posts
    103

    Re: Global Macro Problem

    I keep all my macros in my PERSONAL.xls spreadsheet, and this opens automatically every time I use Excel and is thus available on the list of macros when I hit Alt-F8.
    Last edited by pickarooney; Jul 8th, 2005 at 07:13 AM.

  5. #5

    Thread Starter
    Member
    Join Date
    Jun 2005
    Posts
    48

    Re: Global Macro Problem

    Thank you

    I created Personal.xml

    in XLStart.

    is that correct?

  6. #6

    Thread Starter
    Member
    Join Date
    Jun 2005
    Posts
    48

    Re: Global Macro Problem

    This is my next question then.

    I am trying to call this macro from a VB.NET app, and it says that the macro does not exist.

    Is there anything special I must do in order to have this call proper?

    Thanks again,

    - Josh

  7. #7
    Lively Member
    Join Date
    Apr 2005
    Posts
    103

    Re: Global Macro Problem

    Yes, the normal location is c:\Documents and Settings\username\Application Data\Microsoft\Excel\XLSTART\PERSONAL.XLS
    I've no experience with .NET so I'm not sure how you're supposed to call macros from within a .NET app, but if it's any help the macros are delimited by a ! normally. i.e.
    PERSONAL.XLS!MyNewMacro

  8. #8
    Frenzied Member
    Join Date
    May 2004
    Location
    Carlisle, PA
    Posts
    1,045

    Re: Global Macro Problem

    Joshua:
    =======

    You can also accomplish what you were originally trying to do by declaring your Public Variables in the Open Event for the Workbook. Note that the "ThisWorkbook" is an Object already defined by Excel. Check out this thread:

    http://www.vbforums.com/showthread.php?t=340838

    Good Luck and Good Programming!
    Blessings in abundance,
    All the Best,
    & ENJOY!

    Art . . . . Carlisle, PA . . USA

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width