Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default How to run an Excel 2007 macro from a VB program ?

I need to create reports in Excel format, and the easiest way for me to do
that is to have an Excel macro pull the data from the database and use the
data to fill in a pre-formatted sheet that it subsequently saves as a new
workbook. So far so good, I got the macro working and generating the reports.
Now I need to automate those reports in a way that will not require any
human intervention at any stage. I also need to email the reports after Excel
is done generating them.

I'd like to write a VB.NET program that will call the Excel macro (a VBA Sub
in an Excel module), and subsequently email the report.

How can a VB.NET program trigger an Excel VBA macro ?



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default How to run an Excel 2007 macro from a VB program ?

If you have a reference to the Excel Application object, you can call the
Run method to run a macro in any open workbook. E.g.,

XLApp.Run "BookName.xls!MacroName"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"AlanKohl" wrote in message
...
I need to create reports in Excel format, and the easiest way for me to do
that is to have an Excel macro pull the data from the database and use the
data to fill in a pre-formatted sheet that it subsequently saves as a new
workbook. So far so good, I got the macro working and generating the
reports.
Now I need to automate those reports in a way that will not require any
human intervention at any stage. I also need to email the reports after
Excel
is done generating them.

I'd like to write a VB.NET program that will call the Excel macro (a VBA
Sub
in an Excel module), and subsequently email the report.

How can a VB.NET program trigger an Excel VBA macro ?





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default How to run an Excel 2007 macro from a VB program ?

Thank you, that's what I was looking for.

"Chip Pearson" wrote:

If you have a reference to the Excel Application object, you can call the
Run method to run a macro in any open workbook. E.g.,

XLApp.Run "BookName.xls!MacroName"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"AlanKohl" wrote in message
...
I need to create reports in Excel format, and the easiest way for me to do
that is to have an Excel macro pull the data from the database and use the
data to fill in a pre-formatted sheet that it subsequently saves as a new
workbook. So far so good, I got the macro working and generating the
reports.
Now I need to automate those reports in a way that will not require any
human intervention at any stage. I also need to email the reports after
Excel
is done generating them.

I'd like to write a VB.NET program that will call the Excel macro (a VBA
Sub
in an Excel module), and subsequently email the report.

How can a VB.NET program trigger an Excel VBA macro ?






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
Excel 2007 error when opening program gailg Excel Discussion (Misc queries) 0 December 2nd 09 02:55 PM
unable to open the excel program 2007 Jim Jam Excel Discussion (Misc queries) 2 November 28th 09 05:08 PM
Excel 2007 Chart in VB6 Program AGP Charts and Charting in Excel 0 July 19th 08 04:49 PM
Excel 2007 doesn't detect OneCare as an antivirus program David Walker Setting up and Configuration of Excel 1 January 3rd 08 07:52 PM
Is the statistics program, Megastat, compatible with Excel 2007? tzara New Users to Excel 2 September 19th 07 04:48 PM


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