Thread: Auto Macros
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default Auto Macros

Sorry Steve. Misunderstood you. In the Workbook_Open event place the
following statement:
Application.Wait (Now + TimeValue("0:00:10"))

This tells excel to wait 10 seconds. You can adjust it as you need to.
After the above line, place the code to call the sub that formats the info.


"Steve Happ" wrote:

Hi JNW:

The SQL data pull is done through Import Data wtih MS Query, so the only
code I see is SQL .... Run "Format" doesn't work in the SQL Statement.

Steve

"JNW" wrote:

In the code for the data pull from SQL, at the very end of the sub place the
following:
Run "FormattingSub" 'use the name of your recorded macro

This will call the formatting sub to run only after the data pull is complete

"Steve Happ" wrote:

Hello:

Using Excel 2003

I have an Excel sheet that is set to refresh data using SQL upon open. That
works great. I also want to run a simple macro that I recorded and saved in
the worksheet that formats the data AFTER the data is pulled. How do I do
this?

I tried the auto_open macro, but that runs BEFORE the data is pulled. I
need it to run AFTER the data is pulled.

Thanks for your help

Steve