Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 246
Default VBScript help

Hello All,

The following vbs file runs ok:


Set XL=CreateObject("Excel.Application")
XL.Visible=True
XL.Workbooks.Open "\\blahblah\xxx.xlsm"
blUpdateAll = True
blUpdateFormatting = True
XL.Run "'xxx.xlsm'!UpdateAllWorkbooks"
XL.Run "'xxx.xlsm'!SaveJCfolder"
XL.Workbooks("xxx.xlsm").close false
XL.quit
Set XL=nothing

.....problem is that the two variables blUpdateAll & blUpdateFormatting
are used in the programs UpdateAllWorkbooks & SaveJCfolder but that
doesn't seem to be the case. It's like the variables are being stored
but they aren't available to the programs

Any help much appreciated

Jason.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 420
Default VBScript help

I don't use VBS very often, but it looks like you're creating a new instance of
excel. Then opening xxx.xlsm. So that's the only file/workbook open in that
instance of excel.

Maybe you have to open the other workbooks in that same instance of excel -- or
maybe you want to open xxx.xlsm in the (already) running instance of excel.



On 10/19/2010 08:24, WhytheQ wrote:
Hello All,

The following vbs file runs ok:


Set XL=CreateObject("Excel.Application")
XL.Visible=True
XL.Workbooks.Open "\\blahblah\xxx.xlsm"
blUpdateAll = True
blUpdateFormatting = True
XL.Run "'xxx.xlsm'!UpdateAllWorkbooks"
XL.Run "'xxx.xlsm'!SaveJCfolder"
XL.Workbooks("xxx.xlsm").close false
XL.quit
Set XL=nothing

....problem is that the two variables blUpdateAll& blUpdateFormatting
are used in the programs UpdateAllWorkbooks& SaveJCfolder but that
doesn't seem to be the case. It's like the variables are being stored
but they aren't available to the programs

Any help much appreciated

Jason.


--
Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default VBScript help

I also use VBS very little ... my observation is that the OP is creating
two variables within the script processor; he needs to pass those values
to the called macros somehow.

Perhaps:

blUpdateAll = True
blUpdateFormatting = True
XL.Run "'xxx.xlsm'!UpdateAllWorkbooks" blUpdateAll ,
blUpdateFormatting XL.Run "'xxx.xlsm'!SaveJCfolder" blUpdateAll ,
blUpdateFormatting


would work? Of course, the two called macros would need to be looking
for parameters.

Clif

"Dave Peterson" wrote in message
...
I don't use VBS very often, but it looks like you're creating a new
instance of excel. Then opening xxx.xlsm. So that's the only
file/workbook open in that instance of excel.

Maybe you have to open the other workbooks in that same instance of
excel -- or maybe you want to open xxx.xlsm in the (already) running
instance of excel.



On 10/19/2010 08:24, WhytheQ wrote:
Hello All,

The following vbs file runs ok:


Set XL=CreateObject("Excel.Application")
XL.Visible=True
XL.Workbooks.Open "\\blahblah\xxx.xlsm"
blUpdateAll = True
blUpdateFormatting = True
XL.Run "'xxx.xlsm'!UpdateAllWorkbooks"
XL.Run "'xxx.xlsm'!SaveJCfolder"
XL.Workbooks("xxx.xlsm").close false
XL.quit
Set XL=nothing

....problem is that the two variables blUpdateAll&
blUpdateFormatting
are used in the programs UpdateAllWorkbooks& SaveJCfolder but that
doesn't seem to be the case. It's like the variables are being stored
but they aren't available to the programs

Any help much appreciated

Jason.


--
Dave Peterson




--
Clif McIrvin

Change nomail.afraid.org to gmail.com to reply by email.
(nomail.afraid.org has been set up specifically for
use in usenet. Feel free to use it yourself.)


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default VBScript help

Looks like word wrap munched my suggestion ... I'll try again:

blUpdateAll = True

blUpdateFormatting = True

XL.Run "'xxx.xlsm'!UpdateAllWorkbooks" blUpdateAll , blUpdateFormatting

XL.Run "'xxx.xlsm'!SaveJCfolder" blUpdateAll , blUpdateFormatting


"Clif McIrvin" wrote in message
...
I also use VBS very little ... my observation is that the OP is
creating two variables within the script processor; he needs to pass
those values to the called macros somehow.

Perhaps:

blUpdateAll = True
blUpdateFormatting = True
XL.Run "'xxx.xlsm'!UpdateAllWorkbooks" blUpdateAll ,
blUpdateFormatting XL.Run "'xxx.xlsm'!SaveJCfolder" blUpdateAll ,
blUpdateFormatting


would work? Of course, the two called macros would need to be looking
for parameters.

Clif

"Dave Peterson" wrote in message
...
I don't use VBS very often, but it looks like you're creating a new
instance of excel. Then opening xxx.xlsm. So that's the only
file/workbook open in that instance of excel.

Maybe you have to open the other workbooks in that same instance of
excel -- or maybe you want to open xxx.xlsm in the (already) running
instance of excel.



On 10/19/2010 08:24, WhytheQ wrote:
Hello All,

The following vbs file runs ok:


Set XL=CreateObject("Excel.Application")
XL.Visible=True
XL.Workbooks.Open "\\blahblah\xxx.xlsm"
blUpdateAll = True
blUpdateFormatting = True
XL.Run "'xxx.xlsm'!UpdateAllWorkbooks"
XL.Run "'xxx.xlsm'!SaveJCfolder"
XL.Workbooks("xxx.xlsm").close false
XL.quit
Set XL=nothing

....problem is that the two variables blUpdateAll&
blUpdateFormatting
are used in the programs UpdateAllWorkbooks& SaveJCfolder but that
doesn't seem to be the case. It's like the variables are being
stored
but they aren't available to the programs

Any help much appreciated

Jason.


--
Dave Peterson




--
Clif McIrvin

Change nomail.afraid.org to gmail.com to reply by email.
(nomail.afraid.org has been set up specifically for
use in usenet. Feel free to use it yourself.)




--
Clif McIrvin

Change nomail.afraid.org to gmail.com to reply by email.
(nomail.afraid.org has been set up specifically for
use in usenet. Feel free to use it yourself.)


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 246
Default VBScript help

Thanks for all the help folks.

I just ended up creating an extra little subroutine "Sub
RunRemotely()" in the excel file which gives the specified values to
the two variables - the vbs file now just looks like:

Set XL=CreateObject("Excel.Application")
XL.Visible=True
XL.Workbooks.Open "\\imsfileserve\xxx.xlsm"
XL.Run "'xxx.xlsm'!RunRemotely"
XL.Workbooks("xxx.xlsm").close false
XL.quit
Set XL=nothing


....ONE FURTHER QUESTION:
I'm using these .vbs files, run using Scheduled Tasks, to run various
macros on a server dedicated to churning out Excel reports - what
alternative methods would you use? (bearing in mind the routines can
take upwards of 20minutes to run using lots of aPCs resources while
running ?

All help appreciated
Jason.


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 420
Default VBScript help

I don't have an alternate suggestion. But there are lots of scheduling programs
available (search google) if you're not happy with what's built into windows.

On 10/20/2010 04:23, WhytheQ wrote:
Thanks for all the help folks.

I just ended up creating an extra little subroutine "Sub
RunRemotely()" in the excel file which gives the specified values to
the two variables - the vbs file now just looks like:

Set XL=CreateObject("Excel.Application")
XL.Visible=True
XL.Workbooks.Open "\\imsfileserve\xxx.xlsm"
XL.Run "'xxx.xlsm'!RunRemotely"
XL.Workbooks("xxx.xlsm").close false
XL.quit
Set XL=nothing


...ONE FURTHER QUESTION:
I'm using these .vbs files, run using Scheduled Tasks, to run various
macros on a server dedicated to churning out Excel reports - what
alternative methods would you use? (bearing in mind the routines can
take upwards of 20minutes to run using lots of aPCs resources while
running ?

All help appreciated
Jason.


--
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
Set a reference to Microsoft VBScript Regular Expressions(vbscript.dll) cate Excel Programming 2 December 1st 09 03:07 PM
Vbscript and VBA Office_Novice Excel Programming 7 July 31st 09 11:23 AM
Please help with ADO and VBScript! jenhu[_2_] Excel Programming 1 March 23rd 06 05:06 PM
VBscript sebastienm Excel Programming 0 September 22nd 04 08:24 PM
VBscript raji Excel Programming 0 September 22nd 04 08:03 PM


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