Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Start up macro

I struggle with a workflow that is supposed to run unattended. It includes the following steps:

1) Creation of sdv-file from Oracle
2) Importing the sdv-file in a ready made Excel file. Updating some pivots.
3) Sending the Excel file to a colleague.

Task #1 and #3 is programmed and running unattended already, but i need help with the Excel prosessing. I guess it can be solved this way:

a) I call the "Master.xls" which has a start up macro.
Question: It's possible to dedicate a start-up macro to a single excel-file, right? I would appreciate any reference to have this can be done.

b) The macro is being executed (i should manage this by my own...)

c) After dataprocessing, i want to save the file as "Clone.xls". This version of the file should not hold the start-up macro.
Question: Is it possible? How?

Thanks in advance!
Kjetil
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Start up macro

Hi Kjetil,

The WorkBook_Open event may be used to import
data and update tthe pivot tables,

For an overview of event procedures, see Chip Pearson
at:

Event Procedures
http://www.cpearson.com/excel/events.htm

To save a copy of the resultant file without theWorkBook_Open
code, save the required sheets in a new workbook, for example

Sheets(Array("Sheet1", "Sheet2")).Copy

Then, save the new worbook and close rthe original without
saving changes.

Alternatively, Chip Pearson demonstrates how code can be
removed progammatically at:

Programming To The Visual Basic Editor
http://www.cpearson.com/excel/vbe.htm


---
Regards,
Norman



"Kjetil" wrote in message
...
I struggle with a workflow that is supposed to run unattended. It includes
the following steps:

1) Creation of sdv-file from Oracle
2) Importing the sdv-file in a ready made Excel file. Updating some pivots.
3) Sending the Excel file to a colleague.

Task #1 and #3 is programmed and running unattended already, but i need help
with the Excel prosessing. I guess it can be solved this way:

a) I call the "Master.xls" which has a start up macro.
Question: It's possible to dedicate a start-up macro to a single excel-file,
right? I would appreciate any reference to have this can be done.

b) The macro is being executed (i should manage this by my own...)

c) After dataprocessing, i want to save the file as "Clone.xls". This
version of the file should not hold the start-up macro.
Question: Is it possible? How?

Thanks in advance!
Kjetil


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 535
Default Start up macro

Hi Kjetil,

a) I call the "Master.xls" which has a start up macro.
Question:
It's possible to dedicate a start-up macro to a single excel-file,
right? I would appreciate any reference to have this can be done.


Open the ThisWorkbook module, click on the lefthand dropdown at the
topand choose Workbook. The Workbook_Open event is inserted for you
automatically. Other events are available trough the righthand dropdown
list.

In the Workbook_Open stub, put a call to your startup macro (Advice:
put as much as your code in subs in a normal module as opposed to in
Thisworkbook).

b) The macro is being executed (i should manage this by my
own...)


You'll have a problem with macro enabling though, unless you either set
macro security to low, or digitally sign your VBA code.

c) After dataprocessing, i want to save the file as
"Clone.xls". This version of the file should not hold the start-up
macro.
Question: Is it possible? How?


Yes:

Dim oNewBk as workbook
Thisworkbook.Worksheets.Copy
Set Set oNewbook=ActiveWorkbook
oNewBook.SaveAs "Clone.xls"
oNewbook.Close
Set oNewBook=Noting

Note that code behind the worksheets will travel with your copy, but
normal modules, class modules, thisworkbook module are all left as is:
empty.

Regards,

Jan Karel Pieterse
Excel MVP
http://www.jkp-ads.com
Member of:
Professional Office Developer Association
www.proofficedev.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Start up macro

Thanks a lot, Jan!

Kjetil


"Jan Karel Pieterse" skrev i melding
...
Hi Kjetil,

a) I call the "Master.xls" which has a start up macro.
Question:
It's possible to dedicate a start-up macro to a single excel-file,
right? I would appreciate any reference to have this can be done.


Open the ThisWorkbook module, click on the lefthand dropdown at the
topand choose Workbook. The Workbook_Open event is inserted for you
automatically. Other events are available trough the righthand dropdown
list.

In the Workbook_Open stub, put a call to your startup macro (Advice:
put as much as your code in subs in a normal module as opposed to in
Thisworkbook).

b) The macro is being executed (i should manage this by my
own...)


You'll have a problem with macro enabling though, unless you either set
macro security to low, or digitally sign your VBA code.

c) After dataprocessing, i want to save the file as
"Clone.xls". This version of the file should not hold the start-up
macro.
Question: Is it possible? How?


Yes:

Dim oNewBk as workbook
Thisworkbook.Worksheets.Copy
Set Set oNewbook=ActiveWorkbook
oNewBook.SaveAs "Clone.xls"
oNewbook.Close
Set oNewBook=Noting

Note that code behind the worksheets will travel with your copy, but
normal modules, class modules, thisworkbook module are all left as is:
empty.

Regards,

Jan Karel Pieterse
Excel MVP
http://www.jkp-ads.com
Member of:
Professional Office Developer Association
www.proofficedev.com



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Start up macro

Thanks a lot, Norman!

Kjetil


"Norman Jones" skrev i melding
...
Hi Kjetil,

The WorkBook_Open event may be used to import
data and update tthe pivot tables,

For an overview of event procedures, see Chip Pearson
at:

Event Procedures
http://www.cpearson.com/excel/events.htm

To save a copy of the resultant file without theWorkBook_Open
code, save the required sheets in a new workbook, for example

Sheets(Array("Sheet1", "Sheet2")).Copy

Then, save the new worbook and close rthe original without
saving changes.

Alternatively, Chip Pearson demonstrates how code can be
removed progammatically at:

Programming To The Visual Basic Editor
http://www.cpearson.com/excel/vbe.htm


---
Regards,
Norman



"Kjetil" wrote in message
...
I struggle with a workflow that is supposed to run unattended. It includes
the following steps:

1) Creation of sdv-file from Oracle
2) Importing the sdv-file in a ready made Excel file. Updating some
pivots.
3) Sending the Excel file to a colleague.

Task #1 and #3 is programmed and running unattended already, but i need
help with the Excel prosessing. I guess it can be solved this way:

a) I call the "Master.xls" which has a start up macro.
Question: It's possible to dedicate a start-up macro to a single
excel-file, right? I would appreciate any reference to have this can be
done.

b) The macro is being executed (i should manage this by my own...)

c) After dataprocessing, i want to save the file as "Clone.xls". This
version of the file should not hold the start-up macro.
Question: Is it possible? How?

Thanks in advance!
Kjetil



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
How do you start a Macro? Michael New Users to Excel 7 February 27th 10 04:55 PM
Sub Macro vrs Function Macro Auto Start Pat Excel Discussion (Misc queries) 7 June 6th 07 09:53 PM
start a macro johnT Excel Worksheet Functions 2 March 6th 05 06:43 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM
Can I start a macro using a # key? Ftca Excel Programming 2 October 13th 03 04:55 PM


All times are GMT +1. The time now is 01:06 AM.

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

About Us

"It's about Microsoft Excel"