Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Do not undesratnd the error when calling EXcel macro from .vbs script

I have following Visual BAsic (.vbs) code:
wscript.echo "begin"
set myExcel = CreateObject("Excel.Application")
wscript.echo "before personal"
set myWorkbook = myExcel.Workbooks.Open("C:\Documents and Settings\pmehrotr\Desktop\Local Files\PREM\oraclemonitorlogs\2012\MONITOR.XLSB")
wscript.echo "before macro"
myWorkbook.Run "'MONITOR.XLSB'!kdcallusers"
myEXcel.quit


-----------------
When I run it, it errors at myWorkbook.Run. macro kdcallusers is present in the MONITOR.XLSB file, so I don't know why the error occurs:

begin
before personal
before macro
C:\Documents and Settings\pmehrotr\Desktop\Local Files\PREM\oraclemonitorlogs\20
12\applymacros.vbs(7, 1) Microsoft VBScript runtime error: Object doesn't suppor
t this property or method: 'myWorkbook.Run'

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Do not undesratnd the error when calling EXcel macro from .vbs script

Replace myWorkbook.Run with myExcel.Run
--
Jim Cone
Portland, Oregon USA
http://www.mediafire.com/PrimitiveSoftware
(free and commercial excel programs)



wrote in message
news:5600740.2597.1333854012527.JavaMail.geo-discussion-forums@vbvi18...
I have following Visual BAsic (.vbs) code:
wscript.echo "begin"
set myExcel = CreateObject("Excel.Application")
wscript.echo "before personal"
set myWorkbook = myExcel.Workbooks.Open("C:\Documents and Settings\pmehrotr\Desktop\Local
Files\PREM\oraclemonitorlogs\2012\MONITOR.XLSB")
wscript.echo "before macro"
myWorkbook.Run "'MONITOR.XLSB'!kdcallusers"
myEXcel.quit


-----------------
When I run it, it errors at myWorkbook.Run. macro kdcallusers is present in the MONITOR.XLSB
file, so I don't know why the error occurs:

begin
before personal
before macro
C:\Documents and Settings\pmehrotr\Desktop\Local Files\PREM\oraclemonitorlogs\20
12\applymacros.vbs(7, 1) Microsoft VBScript runtime error: Object doesn't suppor
t this property or method: 'myWorkbook.Run'



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Do not undesratnd the error when calling EXcel macro from .vbs script

On Sunday, April 8, 2012 12:07:08 AM UTC-4, Jim Cone wrote:
Replace myWorkbook.Run with myExcel.Run
--
Jim Cone
Portland, Oregon USA
http://www.mediafire.com/PrimitiveSoftware
(free and commercial excel programs)



wrote in message
news:5600740.2597.1333854012527.JavaMail.geo-discussion-forums@vbvi18...
I have following Visual BAsic (.vbs) code:
wscript.echo "begin"
set myExcel = CreateObject("Excel.Application")
wscript.echo "before personal"
set myWorkbook = myExcel.Workbooks.Open("C:\Documents and Settings\pmehrotr\Desktop\Local
Files\PREM\oraclemonitorlogs\2012\MONITOR.XLSB")
wscript.echo "before macro"
myWorkbook.Run "'MONITOR.XLSB'!kdcallusers"
myEXcel.quit


-----------------
When I run it, it errors at myWorkbook.Run. macro kdcallusers is present in the MONITOR.XLSB
file, so I don't know why the error occurs:

begin
before personal
before macro
C:\Documents and Settings\pmehrotr\Desktop\Local Files\PREM\oraclemonitorlogs\20
12\applymacros.vbs(7, 1) Microsoft VBScript runtime error: Object doesn't suppor
t this property or method: 'myWorkbook.Run'


Jim:
Thanks a lot, that was it. I do not know why many examples on internet were using Run with Workbook instead of Excel.

Prem
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
Pivot Refresh Error when calling Excel Macro from VB.NET program amdefacto Excel Discussion (Misc queries) 0 July 6th 09 10:06 AM
Calling a python script from VBA? NateBuckley Excel Programming 1 August 21st 08 03:37 PM
Calling excel-macros from script? grz01 Excel Programming 5 May 4th 05 11:11 PM
Calling a macro from ActiveX Script. Karunakaran Excel Programming 1 May 2nd 05 12:53 PM
Macro script error - pls help !! Anthony Excel Discussion (Misc queries) 3 February 28th 05 01:49 PM


All times are GMT +1. The time now is 08:21 PM.

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"