Results 1 to 5 of 5

Thread: Workbook Event running VBA question

  1. #1
    Member
    Join Date
    Dec 2012
    Posts
    43
    Rep Power
    0

    Workbook Event running VBA question

    Dear Gurus,

    i have a question, i have a workbook where i want multiple Macros to run once the workbook is opened. i am not sure how do i put it. i have a macro that protects the sheet and the the next macro is to check the username and if not desired user then workbook to close.

    in the workbook event windows



    i am wondering whether i can put the command of call or run for the macros

    Workbook_Open

    run Macro1

    run macro2

    end sub

    or to use call instead of run. i am bit confused here. can you help please.

    thanks.

    Seasons's Greetings

  2. #2
    Senior Member LalitPandey87's Avatar
    Join Date
    Sep 2011
    Posts
    222
    Rep Power
    14
    Hi,

    You can check below link. Download the file and provide user name Lalit Mohan

    https://groups.google.com/forum/#!to...os/BUiOJAAQHcw

    Open this file Press Alt + F11 and in left side double click on ThisWorkbook and see the code for Workbook_Open Event.
    Last edited by LalitPandey87; 12-24-2012 at 08:44 AM.

  3. #3
    Senior Member LalitPandey87's Avatar
    Join Date
    Sep 2011
    Posts
    222
    Rep Power
    14
    You can do it like this:

    Code:
    Private Sub Workbook_Open()
    
        Call Macro1
    
        Call macro2
        
    End Sub

  4. #4
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10
    @ Lalit,

    Please feel free to upload the workbook here
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

  5. #5
    Member
    Join Date
    Dec 2012
    Posts
    43
    Rep Power
    0
    Mr. Pandey,

    thank you very much. you have been very active and supportive member of this forum. i wish and hope that it stays this way.

    cheers,
    Quote Originally Posted by LalitPandey87 View Post
    You can do it like this:

    Code:
    Private Sub Workbook_Open()
    
        Call Macro1
    
        Call macro2
        
    End Sub

Similar Threads

  1. hard question
    By mahmoud-lee in forum Excel Help
    Replies: 1
    Last Post: 05-28-2013, 02:27 PM
  2. Macro stops running if date is not in past...
    By Carlos Arruda in forum Excel Help
    Replies: 4
    Last Post: 03-10-2013, 04:33 PM
  3. Running a VBA in all excel files
    By msiyab in forum Excel Help
    Replies: 3
    Last Post: 12-26-2012, 01:35 PM
  4. Question
    By lokvan in forum Excel Help
    Replies: 1
    Last Post: 12-04-2012, 08:49 AM
  5. Assign an event to chart on workbook open
    By LalitPandey87 in forum Excel Help
    Replies: 2
    Last Post: 02-20-2012, 07:43 AM

Posting Permissions

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