Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.setup,microsoft.public.excel.templates
external usenet poster
 
Posts: 70
Default Running Excel as a batch job AND in the background


"Robert Stober" wrote in message
...
Thank Andy! This worked for me! I edited your command as follows:

Set xlObj = CreateObject("Excel.application")
xlObj.Workbooks.Open "H:\licana\licuser\orders\22345585\template.xl s"
xlObj.Quit

Can I use an environemnt variable inside VB? I want the order number
("22345585" in this case) to be contained in an enviroment variable. This

is
what I do inside aVBA template:

Dim orderNum As Long
Dim fPath As String
orderNum = Environ("orderNum")
fpath = "H:\licana\licuser\orders\" & orderNum & "\template.xls"

Can I do this in VB? My book doesn't mention enviroment variables...


How about saving it in the registry instead? - use SaveSetting to store and
getsetting to get it back.

HTH

Geoff



Thanks again,

Robert



"Andy Wiggins" wrote in message
...
Try something like this. Save it in a standard text file with a .VBS
extention.
This one creates an Excel object, opens a workbook, sets a value, runs a

VBA
routine, then tides up and closes down.

Set xlObj = CreateObject("Excel.application")
xlObj.Workbooks.Open "C:\Byg\textfile\TextFileReformat.xls"
xlObj.Range("NoOfCharsPerLine").Value = 50
xlObj.Run "ReadFromTextFile"
xlObj.ActiveWorkbook.Saved = True
xlObj.ActiveWindow.Close
xlObj.Quit

--
Regards
Andy Wiggins FCCA
www.BygSoftware.com
Excel, Access and VBA Consultancy
-
"Robert Stober" wrote in message
...
Hi,

I'm trying to get my Excel template to run in the background as a

batch
job.
I have no problem running it as a batch job, but I don't want Excel to

show
up on the screen of the execution host. So I'm trying to use the

/embedded
switch.

On the command line: "C:\Program Files\Microsoft

Office\Office\EXCEL.EXE"
/embedded template.xls

I've also tried setting FTYPE on the command line:

Excel.Sheet.8="C:\program Files\Microsoft Office\Office\Excel.EXE"

/embedded
start template.xls

Either way, the dialog (not the usual one) pops up to verify whether I

want
to allow Macros, the Excel.exe process is started, and exits as it

should
(due to Application.Quit).

But in the end, the files that should be created aren't there. It

works
fine
if I don't specify "/embedded". There's no sign of them anywhere on my
computer...

I feel that I could solve this if I could "see" what's going on. I

have
no
visibility into the process. Is there a way to write a log file?

Thank you very much,

Robert Stober








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
background commands running in Excel? AnalystMark Excel Discussion (Misc queries) 1 January 26th 10 05:42 PM
How do I restore excel running in the background? BillS Excel Discussion (Misc queries) 0 August 31st 06 08:26 PM
Hide Excel session when running at the batch mode xiaoxshi Excel Discussion (Misc queries) 1 July 23rd 06 03:54 PM
Running a batch file from VB Graham Carter Excel Programming 3 August 29th 03 04:18 PM
Running a batch file from Excel VBA verizon Excel Programming 1 July 20th 03 09:27 AM


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