Consulting

Results 1 to 10 of 10

Thread: Suffixes for sub command

  1. #1

    Suffixes for sub command

    Hello,

    does anyone know where I can find all the suffixes for the sub command which make the sub run when a certain action is taken (i.e. opening a workbook, changing a cell, renaming a sheet, clicking a button, etc) I have figured some of these out but would like to know which ones are possible.

    TIA
    Frank

  2. #2
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    You can see these in the VBE. From the first drop down (above the Code Window) select Worksheet (when in a Worksheet module) or Workbook (when in the ThisWorkbook module) and from the second drop down select the event.

    Or in Excel VBA help search for Worksheet Object Events or Workbook Object Events or Application Object Events. Application Object Events require you to create a custom class module. Check this KB Entry for an example.

    Application Object Events
    NewWorkbook
    SheetActivate
    SheetBeforeDoubleClick
    SheetBeforeRightClick
    SheetCalculate
    SheetChange
    SheetDeactivate
    SheetFollowHyperlink
    SheetSelectionChange
    SheetPivotTableUpdate
    WindowActivate
    WindowDeactivate
    WindowResize
    WorkbookActivate
    WorkbookAddinInstall
    WorkbookAddinUninstall
    WorkbookBeforeClose
    WorkbookBeforePrint
    WorkbookBeforeSave
    WorkbookDeactivate
    WorkbookNewSheet
    WorkbookOpen
    WorkbookPivotTableCloseConnection
    WorkbookPivotTableOpenConnection

    Workbook Object Events

    Activate
    AddinInstall
    AddinUninstall
    BeforeClose
    BeforePrint
    BeforeSave
    Deactivate
    NewSheet
    Open
    PivotTableCloseConnection
    PivotTableOpenConnection
    SheetActivate
    SheetBeforeDoubleClick
    SheetBeforeRightClick
    SheetCalculate
    SheetChange
    SheetDeactivate
    SheetFollowHyperlink
    SheetPivotTableUpdate
    SheetSelectionChange
    WindowActivate
    WindowDeactivate
    WindowResize

    Worksheet Object Events
    Activate
    BeforeDoubleClick
    BeforeRightClick
    Calculate
    Change
    Deactivate
    FollowHyperlink
    PivotTableUpdate
    SelectionChange

  3. #3
    thanks again Jake, I've been looking all over the place but couldn't find the right term to look for in the help index.

  4. #4
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    You're Welcome

    Take Care

  5. #5
    Now I am trying to have the sheet show a userform upon opening

    I make a class module and insert the following

    Private Sub App_WorkbookOpen(ByVal Wb As Workbook)
    Hoofdmenu.Show
    End Sub

    now I have certified my Macro's so excel turns them on automatically, now it takes a long time to load now but it doesnt show a userform upon opening.

  6. #6
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    You don't need a Class Module. Just use the Open Event in the ThisWorkbook module.

  7. #7
    how does that look like in VBA code, I now just put this


    Private Sub App_WorkbookOpen(ByVal Wb As Workbook)
    Hoofdmenu.Show
    End Sub

    in the this workbook module

    TIA

  8. #8
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    No, select the event from the drop downs so it is entered correctly. It is important that name and arguments are exactly correct.

  9. #9
    got it working like it should thanks.

    I am going to put up a big DRJ-shrine in my house for being the VBA master that you are

  10. #10
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    Always glad to help.

Posting Permissions

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