Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.setup,microsoft.public.excel.templates
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
background commands running in Excel? | Excel Discussion (Misc queries) | |||
How do I restore excel running in the background? | Excel Discussion (Misc queries) | |||
Hide Excel session when running at the batch mode | Excel Discussion (Misc queries) | |||
Running a batch file from VB | Excel Programming | |||
Running a batch file from Excel VBA | Excel Programming |