Guys look at this simple code:
ExcelFile = "test.xls"
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.workbooks.open(ExcelFile)
Thats it! thats the entire code and yet I get the "object required objExcel" how is that possible. I'm setting the object before I call on it. Any ideas..??
simple script
Moderators: Dorian (MJT support), JRL
-
- Junior Coder
- Posts: 36
- Joined: Fri Oct 12, 2007 5:55 pm
- Location: federal way wa
- Contact:
I assume you're not trying to run VBScript as Macro Scheduler Script. If you are, look up VBSTART, VBRun and VBEVal in help. Also the file "test.xls" needs a path. I put test.xls in the root of C: (windows XP) and the following opens the file for me.
There is no Excel GUI available but looking in Task Manager, I can see that excel is running.
There is no Excel GUI available but looking in Task Manager, I can see that excel is running.
Code: Select all
VBSTART
Sub OpenExcel
ExcelFile = "c:\test.xls"
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.workbooks.open(ExcelFile)
End Sub
VBEND
VBRun>OpenExcel
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
If you want to make Excel visible modify as follows:
Code: Select all
VBSTART
Sub OpenExcel
ExcelFile = "c:\test.xls"
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = true
Set objWorkbook = objExcel.workbooks.open(ExcelFile)
End Sub
VBEND
VBRun>OpenExcel
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Junior Coder
- Posts: 36
- Joined: Fri Oct 12, 2007 5:55 pm
- Location: federal way wa
- Contact:
-
- Junior Coder
- Posts: 36
- Joined: Fri Oct 12, 2007 5:55 pm
- Location: federal way wa
- Contact: