Using VBA to Open another Excel File without file path

L

Legacy 367316

Guest
I have 3 different workbooks that I'm working with. 2 of the workbooks are reports that are automatically saved to a random temporary internet file folder. I was wondering if I can somehow activate the 2 workbooks without knowing the file path since they will saved to a random folder every time a report is run. I want to take the data from the 2 folders and extract it to the 3rd workbook. This is what I have so far: I keep getting error Run-time error '9': subscript out of range

Sub Macro3()
'
' Macro3 Macro
'





Windows("Report1_FileName").Activate
Sheets("Sheet1").Select
Range("A30:J1000").Select
Selection.Copy
Windows("Root File.xlsm").Activate
Sheets("Sheet1").Select
Range("A1").Select
ActiveSheet.Paste
Sheets.Add After:=Sheets(Sheets.Count)
Windows("Report2_FileName").Activate
Sheets("Sheet1").Select
Range("A1:T1000").Select
Selection.Copy
Windows("Root File.xlsm").Activate
Sheets("Sheet2").Select
Range("A1").Select
ActiveSheet.Paste

End Sub
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top