Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to use the same Excel sheet for 2 different Actions?
#1
Solved: 11 Years, 4 Months ago
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
Code:
Set xlWrkbk = xlApp.Workbooks.Open("C:\ListMan.xls")
Set xlWrksht = xlWrkbk.Worksheets("MyDraft") ........
If it comes to the second Action,it gives the following error
Object required: 'xlWrkbk'

Because I didn't use the line
Code:
(Set xlWrkbk = xlApp.Workbooks.Open("C:\ListMan.xls"))
This is my script for second Action.

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
Reply
#2
Solved: 11 Years, 4 Months ago
use "Importsheet" method


action2 script:
Code:
Datatable.Importsheet("C:\ListMan.xls","MyDraft1",Action2)
its code here

Datatable.Importsheet("C:\ListMan.xls","MyDraft2",Action2)
its code here
.
.


Datatable.Importsheet("C:\ListMan.xls","MyDraft8",Action2)
Reply
#3
Solved: 11 Years, 4 Months ago
Hi Raj,
Thank you for the solution
the code is working,but I did a small modification,
DataTable.ImportSheet "C:\ListMan.xls","Excelsheetname","actionname"
Uma
Reply
#4
Solved: 11 Years, 4 Months ago
that is what i meant dear
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Reading data from excel sheet serenediva 1 9,622 03-03-2017, 10:07 AM
Last Post: vinod123
Smile Importing Excel sheet - Reference Values are not recognized michiusa69 3 7,885 01-23-2015, 02:36 AM
Last Post: lkng2001
  How to pass a date from Excel sheet to web form revati.shendure 1 2,973 11-27-2014, 11:54 AM
Last Post: revati.shendure
  clearing excel sheet values beejfred 1 7,514 09-25-2014, 11:43 AM
Last Post: vinod123
  How to call Actions from other Actions Naresh 1 7,982 09-25-2014, 10:26 AM
Last Post: vinod123

Forum Jump:


Users browsing this thread: 1 Guest(s)