tucsondonpepe
New Member
- Joined
- Jan 30, 2022
- Messages
- 43
- Office Version
- 365
- Platform
- Windows
- Web
Good afternoon,
I want to activate an Excel file that resides on OneDrive. This code opens the file.
Sub Copy_Data_From_Excel_File_On_OneDrive()
Set objLogExcel = CreateObject("Excel.Application")
objLogExcel.Visible = True
Set wkbStockTransTable = objLogExcel.Workbooks.Open _
(FileName:="Sign in to your Microsoft account")
Workbooks("9-2022 Summer Season Games Won (A).xlsx").Activate
Sheets("Sheet1").Select
Range("A1").Select
Columns("A:I").Copy
Sheets("Sheet2").Select
With ActiveSheet.Columns("A:I")
.PasteSpecial xlPasteValues
.PasteSpecial xlPasteFormats
End With
End Sub
The Set .... is being changed when I post this. This is what it looks like
The file opens but the "Workbooks("9-2022 Summer Season Games Won (A).xlsx").Activate" line produces the Run-time error '9': subscript out of range.
I want to activate an Excel file that resides on OneDrive. This code opens the file.
Sub Copy_Data_From_Excel_File_On_OneDrive()
Set objLogExcel = CreateObject("Excel.Application")
objLogExcel.Visible = True
Set wkbStockTransTable = objLogExcel.Workbooks.Open _
(FileName:="Sign in to your Microsoft account")
Workbooks("9-2022 Summer Season Games Won (A).xlsx").Activate
Sheets("Sheet1").Select
Range("A1").Select
Columns("A:I").Copy
Sheets("Sheet2").Select
With ActiveSheet.Columns("A:I")
.PasteSpecial xlPasteValues
.PasteSpecial xlPasteFormats
End With
End Sub
The Set .... is being changed when I post this. This is what it looks like
The file opens but the "Workbooks("9-2022 Summer Season Games Won (A).xlsx").Activate" line produces the Run-time error '9': subscript out of range.
Last edited: