MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Runnning a macro automatically after the sheet loads

  Asked By: Francisca    Date: Nov 01    Category: MS Office    Views: 1083

We are running a HP9000 using hpux

Coding in CQCS a 4gl language.

I run there version of an sql statement which create a lotus

spreadsheet which then run excel 2003. This process run just fine.

I created a macro to update the sheet once loaded. Can I run

this macro automatically after the sheet loads? If so how?

New to excel and VBA. Thanks for all your help in advance.



1 Answer Found

Answer #1    Answered By: Sumitra 2004     Answered On: Nov 01

Several years ago, I did something similar with a UNIX application
that exported a file in a "spreadsheet" format.
If I understand your problem correctly, your CQCS application is CREATING a file
that is supposed to be in a spreadsheet format (lotus).
You've also written a macro  that manipulates this data and you would like to
it automatically  run when you open the file.
The problem is that in order for the macro to run  "automatically", it needs to
put in the file and called "Auto_Open" or in the worksheet module as an
Initialize subroutine.
This really can't be done from "outside" the file, for several reasons.
Your macro is a VBA macro module. The file the HP box is creating is in a
format that "resembles" a Lotus 123 file format. Excel recognizes it as a
"spreadsheet" and converts it to Excel when it is opened. It's been many years,
but if I remember correctly, the macros I wrote in Lotus123 did not come across
to Excel when we migrated. So I don't think this approach would work.
The way I got around it is that I created a macro "control" file in Excel.
This file had an Auto_Open macro that in turn, opened the updated data file and
did the file manipulation. So, in essence, instead of opening the data file,
you opened the "control" file and had IT open the data file.

Didn't find what you were looking for? Find more on Runnning a macro automatically after the sheet loads Or get search suggestion and latest updates.