#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Auto Macros

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default Auto Macros

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Auto Macros

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

  #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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deactivating auto macros Jac Tremblay[_3_] Excel Programming 6 July 13th 07 04:00 PM
Auto filling using macros bernard Excel Programming 3 December 29th 05 08:55 PM
Auto-Executing Macros LyndieBee Excel Programming 1 February 15th 05 03:08 AM
Auto New macros? Christine[_6_] Excel Programming 2 August 23rd 04 02:32 PM
Auto load macros ksgoodwin Excel Programming 1 September 9th 03 05:35 AM


All times are GMT +1. The time now is 08:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"