Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Running Excel Macro from VB6

I've got a VB6 program that runs an excel 2000 macro fine
if the spreadsheet is opened by user before running the VB
program. If user doesn't open the spreadsheet an error
occurs.

Is there a way to eliminate need for user to open the
spreadsheet?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Running Excel Macro from VB6

Check if the workbook is open - if not, then open it, then run the macro.

--
Regards,
Tom Ogilvy


"Rick Griffith" wrote in message
...
I've got a VB6 program that runs an excel 2000 macro fine
if the spreadsheet is opened by user before running the VB
program. If user doesn't open the spreadsheet an error
occurs.

Is there a way to eliminate need for user to open the
spreadsheet?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default Running Excel Macro from VB6

Rick,

The workbook will have to be opened to run the macro, whether your user does
it or whether you do from your VB6 app.

If you want some code on opening the workbook, try something like

Set xlApp = CreateObject("Excel.Application")
If Not xlApp Is Nothing Then
xlApp.Workbooks.Open "D:\Bob\My Documents\My
Spreadsheets\Lastcount.xls"
xlApp.Visible = True
xlApp.Run "LastCount.xls!Test"
xlApp.Quit
End If

--

HTH

Bob Phillips

"Rick Griffith" wrote in message
...
I've got a VB6 program that runs an excel 2000 macro fine
if the spreadsheet is opened by user before running the VB
program. If user doesn't open the spreadsheet an error
occurs.

Is there a way to eliminate need for user to open the
spreadsheet?



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
Running Excel macro as a service Yan Excel Discussion (Misc queries) 5 September 30th 08 09:45 PM
Running excel macro by scheduler Dan Excel Discussion (Misc queries) 1 August 19th 07 11:48 PM
Excel running Word macro rsphorler Excel Discussion (Misc queries) 2 May 27th 07 01:19 AM
Running a Macro automatically from Excel Brakeshoe Excel Worksheet Functions 1 July 13th 05 11:23 PM
KERNEL32.DLL error after running EXCEL Macro Dan[_16_] Excel Programming 0 July 23rd 03 08:15 PM


All times are GMT +1. The time now is 11:29 PM.

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"