Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Jan 2001
    Houston, Texas, USA
    Thanked 0 Times in 0 Posts

    AutoMacro & command button (Excel 97)

    I am using Access 97 and Excel 97. I have an Access query that is being imported in Excel. In Excel I would like to know if there is a way I can have my macro (Term1) start the moment I call this spreadsheet.

    I also have a second problem. When my spreadsheet starts I have a command button that will call up a macro (Mailer) after we make the any changes to the spreadsheet. Is there a way to make the command button disappear when I mail it out?

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Salt Lake City, Utah, USA
    Thanked 6 Times in 6 Posts

    Re: AutoMacro & command button (Excel 97)

    Does your import code run from an Excel workbook/template? If so use WorkBook Open and call your import code. In the VBE Project Explorer window, open the Microsoft Excel Objects for the workbook, double click the Workbook Object, in the code pane Object drop-down (upper left) select Workbook and (usually it will be created for you, but if not) from the Procedure drop-down (upper right) select Open. Then you can do lots of things when the workbook is opened including:
    Private Sub Workbook_Open()
    call MyImportAccessData
    End Sub

    You can disable (gray) your button:
    if MyMailCodeRunsOK Then Application.CommandBars(index).Controls(index).Ena bled = False
    or kill it completely,
    if MyMailCodeRunsOK Then Application.CommandBars(index).Controls(index).Del ete
    -John ... I float in liquid gardens
    UTC -7ąDS

Posting Permissions

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