I have opened a new workbook as an Object in the first Sub and need to make use of the opened workbook to do another things in another Sub, can I do that? But I have encountered error: ''Run Time error 424, object required'' as script sample as below, how can I use the opened workbook in another Sub?
Sub test1()
Dim wb as Object
Dim Spreadsheet1 as Object
Set wb = CreatObject ("excel.Appplication")
wb.visiable= true
Set wb = wb.workbooks.Add
Set Spreadsheet1 = wb.Sheets("Sheet1")
Call test2
End Sub
Sub test2()
Spreadsheet1 .Cells(1,1) = "Do Another things"
End Sub