Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Scripting Excel different behavior than Interactive?

We run a number of Excel spreadsheets via a scheduling system to do overnight
batch calcs. Each of the spread sheets contain a macro called "RunReport"

I've recently built a new machine and installed Office and all seems fine.
If I load the spreadsheet and manually run the macro "RunReport" it all works
as expected.

But if I run a spreadsheet using a VB Script (snippet below), I get a
circular reference. Has anyone seen this before or have any thoughts on the
matter?

I can't imagine it's the sheet as it runs just fine on the old box
interactively and via a script.

New box Excel Version 9.0.3821 SR-1
Old box Excel Version 9.0.2720

Did the service pack break something?

==================================
Dim Excel
Dim SheetPath

Set objNet = WScript.CreateObject("WScript.Network")
SheetPath = "D:\Data\Test\"
Set Excel = CreateObject("Excel.Application")
Excel.Application.Visible = True
Excel.Application.Workbooks.Open SheetPath + "Test.xls", 0
Excel.Application.Run("Test.xls!RunReport")
.....

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Scripting Excel different behavior than Interactive?

I think the answer will depend on what RunReport does.

If you rely on the activecell/activesheet, maybe you're not in the spot that you
think you should be in.



Prezent Tenz wrote:

We run a number of Excel spreadsheets via a scheduling system to do overnight
batch calcs. Each of the spread sheets contain a macro called "RunReport"

I've recently built a new machine and installed Office and all seems fine.
If I load the spreadsheet and manually run the macro "RunReport" it all works
as expected.

But if I run a spreadsheet using a VB Script (snippet below), I get a
circular reference. Has anyone seen this before or have any thoughts on the
matter?

I can't imagine it's the sheet as it runs just fine on the old box
interactively and via a script.

New box Excel Version 9.0.3821 SR-1
Old box Excel Version 9.0.2720

Did the service pack break something?

==================================
Dim Excel
Dim SheetPath

Set objNet = WScript.CreateObject("WScript.Network")
SheetPath = "D:\Data\Test\"
Set Excel = CreateObject("Excel.Application")
Excel.Application.Visible = True
Excel.Application.Workbooks.Open SheetPath + "Test.xls", 0
Excel.Application.Run("Test.xls!RunReport")
....


--

Dave Peterson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Scripting Excel different behavior than Interactive?

Prezent,

What happens if you change your code to the following?...

'-----------------------------------------------------------
Sub Test()
Dim appExcel As Excel.Application
Dim objWB As Excel.Workbook
Dim SheetPath As String

'Set objNet = WScript.CreateObject("WScript.Network") ' ?

SheetPath = "D:\Data\Test\"

Set appExcel = New Excel.Application
appExcel.Visible = True ' probably not necessary
Set objWB = appExcel.Workbooks.Open(SheetPath & "Test.xls", 0)
appExcel.Run ("Test.xls!RunReport")

'do more stuff

objWB.Close savechanges:=False
Set objWB = Nothing
appExcel.Quit
Set appExcel = Nothing
End Sub
'-----------------------------------------------------------

Jim Cone
San Francisco, CA


"Prezent Tenz" wrote in message
...
We run a number of Excel spreadsheets via a scheduling system to do overnight
batch calcs. Each of the spread sheets contain a macro called "RunReport"

I've recently built a new machine and installed Office and all seems fine.
If I load the spreadsheet and manually run the macro "RunReport" it all works
as expected.

But if I run a spreadsheet using a VB Script (snippet below), I get a
circular reference. Has anyone seen this before or have any thoughts on the
matter?

I can't imagine it's the sheet as it runs just fine on the old box
interactively and via a script.

New box Excel Version 9.0.3821 SR-1
Old box Excel Version 9.0.2720

Did the service pack break something?

==================================
Dim Excel
Dim SheetPath

Set objNet = WScript.CreateObject("WScript.Network")
SheetPath = "D:\Data\Test\"
Set Excel = CreateObject("Excel.Application")
Excel.Application.Visible = True
Excel.Application.Workbooks.Open SheetPath + "Test.xls", 0
Excel.Application.Run("Test.xls!RunReport")


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 Dashboard without VBA Scripting? binar[_2_] Excel Discussion (Misc queries) 0 March 17th 09 03:21 AM
Scripting in Excel 2007 Tinsel Excel Discussion (Misc queries) 1 February 12th 07 10:42 AM
Excel scripting,programming TechGuyatwork New Users to Excel 2 June 19th 05 06:53 PM
iNTERACTIVE EXCEL FILE NOT INTERACTIVE ON THE WEB kathy in kansas Excel Discussion (Misc queries) 0 January 24th 05 07:47 PM
is excel by itself enough to do scripting? gee at excel Excel Programming 1 October 14th 04 09:03 PM


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