Consulting

Results 1 to 9 of 9

Thread: HOw to run a macro automaticcaly when open a workbook

  1. #1

    HOw to run a macro automaticcaly when open a workbook

    Hello,

    Need to know how to run a macro / module automatically when I open my worksheet. I used below code but it wont run, any idea?
    Thanks.
    Pasi


    'Private Sub Workbook_Open()
    
    Date
     call  myMacro
     End Sub
    Last edited by Aussiebear; 01-31-2014 at 06:39 PM. Reason: enclosed code within tags

  2. #2
    I'm sure your meant to have the code in this section.


  3. #3
    HI Ashley,

    Well I have an personal.xlsm and all my modules are there. DO I need to save it to "this workbook"?

  4. #4
    I try to save it in "this work book"but its telling me to have to save it in a macro enabled file and that's my personal.xlsm .?

  5. #5
    I presume you'll only be running this particular macro on one workbook each time you open it?

    If that's the case, open that workbook, and save the macro in "ThisWorkbook" and then SAVE the file as XLSM format.
    Then each time you open that workbook your macro will run, and presumably it will be calling a macro that is saved in your personal.xlsm file.

  6. #6
    error.jpg

    Ok here is what I am getting I save the file as xlsm??

  7. #7
    OK, you can't just call a macro like that... Because it's looking for the macro FindDuplicates within Book2.xlsm, which doesn't exist.
    So you need to call it from another workbook.

    Try doing this:

    Application.Run "PERSONAL.XLSB!FindDuplicates"
    Instead of Call FindDuplicates

  8. #8
    No its not working?? not sure whats going on? when I tried to save it itgave me msg that it can not be saved in a macro-free workbook, you need to save it in a macro enabled file and I did and now its not working?
    hmm??

  9. #9
    OK Got it to work... thanks!

Posting Permissions

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