+ Reply to Thread
Results 1 to 5 of 5

Run Macro after data is loaded

  1. #1
    Registered User
    Join Date
    08-09-2007
    Posts
    15

    Run Macro after data is loaded

    We have a third party software program with some simple custom reports(created by Acess queries from the main d-base). Users can select a custom report in the GUI to execute the report. Then, the third party program program launches Excel and displays in the queried info, but the data needs to be reformatted a bit (adding subtotals, formatting subtotal lines, adding units of measure to the newly created subtotal lines and etc.) through a macro but the macro has to wait till the data is pulled in before it begins. Is this possible? Thanks for any advice

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    The best thing to do is to create your report, then use the Macro Recorder to record the formatting. This recorded macro can then be tidied up and stored in your PERSONAL.xls.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    08-09-2007
    Posts
    15
    Thanks for the reply. My skill level is not very high in these matters so I can't create a report. But I'll explain the process of the events so you'll have a better idea of my situation.
    The third party software (Aspen) has a user d-base (which links with the main d-base upon opening) and in the user d-base I create custom queries in access, view them in SQL, then copy and paste them in a custom query data table within the user d-base. Also, in the user d-base, there is a custom report table where I specify the report template file name, file location, file type (Excel), worksheet name, & etc. The new report (or Excel worksheet template customized to accept the queried data) appears in the GUI for selection. Once selected and executed the Excel template opens and the data from the predefined query pouplates the worksheet. My problem is that I need to insert and subtotals into the sheet and format the subtotal rows and have this function executed automatically, but when I choose the VBA function "Private Sub Workbook_Open", to execute the macro automatically, the macro executes before the data from query is there? Is there any way to ask the Macro to wait till the data is in the worksheet before executing. Thanks for the help.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Why not have a button to run the macro from after the data is loaded?

  5. #5
    Registered User
    Join Date
    08-09-2007
    Posts
    15
    Ok. Probably will do that. Thanks for your time on this.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1