Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Automating Macros for CSV files

Been all over the 'net looking for an answer to this one, here goes....

I need to collect data in a C++ Net application, then from that same
application automatically (with no keys pressed) do the following:

1) Save the file as an Excel-compatible dataset (I chose CSV for its
simplicity)

2) Fire up Excel and load up the dataset into a worksheet

3) Execute a very extensive macro (over 800 lines) in Excel - this macro can
be installed as a global macro e.g. XLstart directory (see note below) as a
separate file or worksheet
(optional)

4) Leave the focus on the Excel window so the results will appear foremost
to the user


Seems simple, and I've had success with steps 1 and 2 using the
Microsoft::Office::Interop method. HOWEVER, when Excel is started from my
C++ application, none of the global macros are available. This seems to be
some kind of security limitation of global macros. Yes, I tried all four
security settings to no avail. (If you fire up Excel by itself, global
macros in XLStart are available -- but not when C++/Interop starts Excel.
Same thing when starting Excel from a VBScript.)

Is there a way to get Interop/Excel to pull in or execute a macro from a
separate worksheet?

Is it possible to get around the security limitation so global macros are
available via Interop-invoked Excel?

Is there something aside from Interop that I should use to fire up Excel and
get this macro running? One thought was to import an existing Excel document
with the macro already in it and then run the macro, but I can't find a way
to import into a worksheet.


If it helps, my configuration is: C++ Net Standard Edition, Excel 2000
Professional, all on Windows XP Home Edition. The C++ app is a CDialog
window.

Thanks very much for any advice!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Automating Macros for CSV files

I don't use C++ at all, but you can change step 2 to open that addin/workbook:

workbooks.open filename:="C:\yourpath\youraddin.xla"

Then you'll have access to the routines in that addin/workbook.



griffin_5338 wrote:

Been all over the 'net looking for an answer to this one, here goes....

I need to collect data in a C++ Net application, then from that same
application automatically (with no keys pressed) do the following:

1) Save the file as an Excel-compatible dataset (I chose CSV for its
simplicity)

2) Fire up Excel and load up the dataset into a worksheet

3) Execute a very extensive macro (over 800 lines) in Excel - this macro can
be installed as a global macro e.g. XLstart directory (see note below) as a
separate file or worksheet
(optional)

4) Leave the focus on the Excel window so the results will appear foremost
to the user

Seems simple, and I've had success with steps 1 and 2 using the
Microsoft::Office::Interop method. HOWEVER, when Excel is started from my
C++ application, none of the global macros are available. This seems to be
some kind of security limitation of global macros. Yes, I tried all four
security settings to no avail. (If you fire up Excel by itself, global
macros in XLStart are available -- but not when C++/Interop starts Excel.
Same thing when starting Excel from a VBScript.)

Is there a way to get Interop/Excel to pull in or execute a macro from a
separate worksheet?

Is it possible to get around the security limitation so global macros are
available via Interop-invoked Excel?

Is there something aside from Interop that I should use to fire up Excel and
get this macro running? One thought was to import an existing Excel document
with the macro already in it and then run the macro, but I can't find a way
to import into a worksheet.

If it helps, my configuration is: C++ Net Standard Edition, Excel 2000
Professional, all on Windows XP Home Edition. The C++ app is a CDialog
window.

Thanks very much for any advice!


--

Dave Peterson
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
Automating Excel (Macros) Outlook Convert New Users to Excel 5 June 11th 07 10:13 PM
Automating swnding mails using macros on Excel. Brinda Excel Worksheet Functions 1 March 13th 06 03:03 PM
Pulling files in using Macros MSHO Excel Programming 5 January 11th 06 03:21 PM
Automating the depressing of ENABLE MACROS popup Mark Wallwin Excel Programming 1 March 3rd 04 07:20 PM
automating chart generation from text files druid77 Excel Programming 2 October 4th 03 11:12 PM


All times are GMT +1. The time now is 12:39 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"