09-29-2011, 02:35 AM
Hi,
I am using one Excel sheet(It has 9 pages,1st page for action 1 and all the other 8 pages for Action 2).
Both the Actions are Reusable.
If I run my script the First Action opens the Excel sheet and it works fine.
My code for first action
If it comes to the second Action,it gives the following error
Object required: 'xlWrkbk'
Because I didn't use the lineThis is my script for second Action.
I used only the following line.
How to use the same Excel sheet for different Actions,without opening and closing againa nd again.
Any help?
Thank you
Uma
I am using one Excel sheet(It has 9 pages,1st page for action 1 and all the other 8 pages for Action 2).
Both the Actions are Reusable.
If I run my script the First Action opens the Excel sheet and it works fine.
My code for first action
Code:
Set xlWrkbk = xlApp.Workbooks.Open("C:\ListMan.xls")
Set xlWrksht = xlWrkbk.Worksheets("MyDraft") ........
Object required: 'xlWrkbk'
Because I didn't use the line
Code:
(Set xlWrkbk = xlApp.Workbooks.Open("C:\ListMan.xls"))
Code:
Set xlApp = GetObject("","Excel.Application")
If Not xlApp Is Nothing Then
Msgbox "ExcelSheet is already open"
Else
Set xlApp = GetObject("","Excel.Application")
xlApp.visible = true
Set xlWrkbk = xlApp.Workbooks.Open("C:\ListMan.xls")
End If
Set xlWrksht = xlWrkbk.Worksheets("MyLi-Loc")
I used only the following line.
Code:
Set xlWrksht = xlWrkbk.Worksheets("MyDraft") ........
How to use the same Excel sheet for different Actions,without opening and closing againa nd again.
Any help?
Thank you
Uma