Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Sep 2003
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VB code to run macro on file open (NT 2000)

    Just need the command to auto run a macro i have in a file. I want the macro to run once the file is opened so the user doesnt have to do anything. i thought it was auto.run or something liek that. can someone please let me know what i need, thanks.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VB code to run macro on file open (NT 2000)

    What kind of file? What is NT 2000?

  3. #3
    New Lounger
    Join Date
    Sep 2003
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VB code to run macro on file open (NT 2000)

    sorry i have recorded a macro in Excel. We use Office 2000 here. Thanks

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VB code to run macro on file open (NT 2000)

    Activate the Visual Basic Editor (Alt+F11)
    Make sure that the Project Explorer is visible (Ctrl+R)
    If necessary, expand the node corresponding to your Excel workbook, then Microsoft Excel Objects, until you see ThisWorkbook.
    Double click ThisWorkbook to open the code module belonging to it.
    From the Object dropdown list in the upper left of the module window, select Workbook.
    You will see this:

    Private Sub Workbook_Open()

    End Sub

    The Workbook_Open procedure will be executed automatically every time the workbook is opened (provided your macro security is not set to High - I recommend Medium.) You can call the macro you have already created from Workbook_Open.

  5. #5
    New Lounger
    Join Date
    Sep 2003
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VB code to run macro on file open (NT 2000)

    I knwo its dumb questions but what is the command to call my recorded macro that is stored in module1. It is titled "DaysUpdate ()" in the module. thanks a million

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VB code to run macro on file open (NT 2000)

    The command to call DaysUpdate is very simply DaysUpdate <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    Private Sub Workbook_Open()
    DaysUpdate
    End Sub

Posting Permissions

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