Ask Experts Questions for FREE Help !
Ask
    hjalanbo's Avatar
    hjalanbo Posts: 2, Reputation: 1
    New Member
     
    #1

    Sep 25, 2008, 11:26 AM
    Start excel with a macro
    How can I start excel with a macro.
    StaticFX's Avatar
    StaticFX Posts: 943, Reputation: 74
    Senior Member
     
    #2

    Sep 25, 2008, 11:34 AM

    .. please explain more

    Do you want a macro to run when you start excel? Or do you want another app to start excel?
    hjalanbo's Avatar
    hjalanbo Posts: 2, Reputation: 1
    New Member
     
    #3

    Sep 25, 2008, 11:38 AM
    Quote Originally Posted by StaticFX View Post
    .. please explain more

    do you want a macro to run when you start excel? or do you want another app to start excel?
    I would like to start the excel sheet to run a macro that will prompt the user to enter a "code number".

    The code is already there, I need to automate the opening of the sheet to start a macro basically.
    ScottGem's Avatar
    ScottGem Posts: 64,966, Reputation: 6056
    Computer Expert and Renaissance Man
     
    #4

    Sep 25, 2008, 12:10 PM
    From Excel Help

    Have a macro run automatically when you open a workbook
    If you record a macro and save it using the name "Auto_Open", the macro will run whenever you open the workbook that contains the macro. Another way to automatically run a macro when you open a workbook is to write a VBA procedure in the Open event of the workbook by using the Visual Basic Editor. The Open event is a built-in workbook event that runs its macro code each time you open the workbook.

    Create an Auto_Open macro
    1. If you want to save the macro with a particular workbook, open that workbook first.
    2. On the Tools menu, point to Macro, and then click Record New Macro.
    3. In the Macro name box, type Auto_Open.
    4. In the Store macro in box, specify where to save the macro:
      • To save the macro in the current workbook, choose This Workbook.
      • To create a new workbook to save the macro in, choose New Workbook.
      • To save the macro in a hidden workbook that is automatically loaded when you start Excel, choose Personal Macro Workbook.
      Note If you choose Personal Macro Workbook, Excel will create and save the macro in a hidden workbook named Personal.xls (if Personal.xls doesn't already exist). In Windows 2000, Personal.xls is saved in the C:\Documents and Settings\username\Application Data\Microsoft\Excel\XLStart folder so that it will be loaded automatically whenever Excel starts. If you want the macro that you record and save in Personal.xls to act on a particular workbook, you must also save that workbook in the XLStart folder so that it will also be opened when Excel starts.
    5. Click OK, and then perform the actions that you want to record.
    6. On the Stop Recording toolbar, click the Stop Recording button.
    7. If you chose to save the macro in This Workbook or New Workbook in step 4, make sure to save or move the workbook into one of the XLStart folders.
    Recording an Auto_Open macro has a number of limitations:
    • Many actions you may want to perform cannot be recorded.
    • If the workbook in which you save the Auto_Open macro already contains a VBA procedure in its
      • Many actions you may want to perform cannot be recorded.
      • If the workbook in which you save the Auto_Open macro already contains a VBA procedure in its Open event, the VBA procedure for the Open event will override all actions in the Auto_Open macro.
      • An Auto_Open macro is ignored when a workbook is opened programmatically by using the Open method.
      • An Auto_Open macro runs before any other workbooks are opened. Therefore, if you record actions that you want Excel to perform on the default Book1 workbook or on a workbook loaded from the XLStart folder, the Auto_Open macro will fail when you restart Excel because it runs before the default and start-up workbooks are opened.
      event, the VBA procedure for the Open event will override all actions in the Auto_Open macro.
    • An Auto_Open macro is ignored when a workbook is opened programmatically by using the [bbcode][/bbcode] method.
    • An Auto_Open macro runs before any other workbooks are opened. Therefore, if you record actions that you want Excel to perform on the default Book1 workbook or on a workbook loaded from the XLStart folder, the Auto_Open macro will fail when you restart Excel because it runs before the default and start-up workbooks are opened.
    If you encounter these limitations, instead of recording an Auto_Open macro, you must create a VBA procedure for the [bbcode][/bbcode] event as described in the next section of this article.
    Note: the apparent links above are not working links, they work within Excel Help.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Auto-Macro in Excel [ 4 Answers ]

Hi, I have a lot of macros built-in Excel, but when I want to update the certain data , I have to run them individually each time. Do you know anyway I can auto-run these macros? Thanks for any help.

Excel vlookup and auto start macro [ 1 Answers ]

I've set up a vlookuop. I want to retrieve a blank value. Lookupup code is the number 1 and the value for one is blank. At one point it worked fine and now it won't. I've set up a main menu in excelfor excel worksheets in a workbook. When I bookmark a worksheet I would like a macro to autostart...

Recording a macro in Excel [ 2 Answers ]

Need a macro that will select the cell one place to the left, edit the content, hit enter, and then move to cell below where started and repeat to end of column (last cell with a value). Example: 123-456789 is format of cell to be edited - need to remove the hyphen. Someone had created it...

How to Automate a macro in excel [ 4 Answers ]

A program logs files at random in txt. abc_log.txt (example) When new info. Is added to the txt file,manualy activate macro and it does what it suppose to do, all OK there. Is there a way a macro code or excel, or perhaps a BAT program can be made to simply "detect" when new data is added...


View more questions Search