Reputation: 601
when i am trying to get create an sheet object,getting the error:
Dim oFS : Set oFS = CreateObject("Scripting.FileSystemObject")
Dim oXls : Set oXls = CreateObject("Excel.Application")
Dim oWb : Set oWb = oXls.Workbooks.Open(oFs.GetAbsolutePathName("Wing_To_Wing_Report.xlsx"))
Dim aData ': aData = oWb.Worksheets(1).Range("$A2:$C10")
Dim dicP : Set dicP = CreateObject("Scripting.Dictionary")
Dim Range,ObSheet1,ObSheet2
Dim TotalRows,LastCol
ObSheet1=oWb.ActiveWorkbook.Worksheets("WingToWingMay25")
ObSheet2=oWb.ActiveWorkbook.Worksheets("ParentChildLink")
Tried this also:
ObSheet1=oWb.Worksheets("WingToWingMay25")
ObSheet2=oWb.Worksheets("ParentChildLink")
Error Object doesn't support this property or method: "ActiveWorkbook"
Can you help me here? why so.
Upvotes: 2
Views: 292
Reputation: 2794
ActiveWorkbook
partset
keyword in set
ObSheet1=oWb.Worksheets("WingToWingMay25")
Also, I saw from one of your printscreen, you are using Notepad++ to develop,
Instead of just running the script directly,
please use a debugger to test the script.
You can find the debugger here
Using the debugger, you can run the source code line by line,
and use the watch window to see the properties of each object at runtime.
Upvotes: 3
Reputation: 1314
Instead of ObSheet1=oWb.ActiveWorkbook.Worksheets("WingToWingMay25")
, you should do this :
set ObSheet1=oWb.ActiveWorkbook.Worksheets("WingToWingMay25")
Upvotes: 0