Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
An Excel environment started from a VB script .vbs file.
Orlando and Tim, :)
Sorry for the long delay to REPLY!!! :) If you remember, the situation involves W95 with Excel97 and Word97,,,,old stuff but usable. Plus, activating word/excel from a VBS script file and setting/activating to a specific sheet other than a default sheet at Excel file open This WorkBook macro code execution. Also, the issue has been resolved. An Older document on the Microsoft links (wshobj.doc) was found at the following: http://msdn.microsoft.com/scripting/...st/docs/refere nce/wshobj.doc This describes the RUN method as opposed to the EXE method provided in the newer 5.6 version of Scripting. RUN worked as expected. Again, sorry for the DELAY in the REPLY and, THANKS for your Time, Help, and Advise!!!! Jerry -----Original Message----- Set objXl = WScript.CreateObject("EXCEL.application") objXL.Workbooks.Open "c:\TEST\TEST.xls" objXL.ActiveWorkbook.RunAutoMacros xlAutoOpen tim "Jerry" wrote in message ... Hello, Thanks for your Time, Help, and Advise,,,,, :) :) There are two situations involved: 1. Activation of an Excel97 file (TEST.xls) from within a VB Script file (TEST.vbs). 2. The execution of Excel methods in the VBE macro code placed in the ThisWorkbook area for the WorkBook Open. The TEST.vbs file has the following code: msgbox ("Starting Excel with an *.xls file") Dim objXL Set objXl = WScript.CreateObject ("EXCEL.application") objXL.Workbooks.Open "c:\TEST\TEST.xls" objXL.Visible = True The WorkBook Open code in the TEST.xls file for ThisWorkbook is the following: Private Sub Workbook_Open() Worksheets("TestA").Visible = True Worksheets("TestB").Visible = True Sheets("TestB").Select Application.WindowState = xlNormal End Sub The Sheets("TestB").Select code in the open will not make the TestB sheet the active sheet if the TEST.xls Excel environment is started by poking on TEST.vbs script file. However, when starting the TEST.xls Excel environment by poking on the TEST.xls file, the Sheets("TestB").Select will make the TestB sheet the active sheet. It appears that Excel Object/Methods are not active when the TEST.xls file is activated from the TEST.vbs code. I have tried many things in the TEST.xls file VBE macro but with no success. There is a lot more logic in the TEST.xls file than in the example above that work such as activating forms, prompting for data inputs, opening files, creating directories, etc. Also, I am still learning about many things and the VB Scripting tool and Objects is a new effort. So, I am sure there is probably a simple solution that I just cannot identify at this time. Any advise would be TERRRRIFFFICCCCC!!!!! THANKS for your Time, Help, and Advise!!!! :) Jerry . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to do something in an VBS script for all worksheets of an Excel file? | Excel Discussion (Misc queries) | |||
can't save VBA script when saving excel file | Excel Discussion (Misc queries) | |||
Excel started, but not the file | Excel Discussion (Misc queries) | |||
Personal macro file will not pull up when excel is started | Setting up and Configuration of Excel | |||
Script to save Excel file to the server. | Excel Discussion (Misc queries) |