VBA Runtime Error cant locate file location

Snowlock64

New Member
Joined
Jan 28, 2019
Messages
1
Whenever I record a macro the vba always adds an additional section on where to locate the file. As you can see below actual location for the file is located on the H: Drive but it adds an openfilename= in C Drive. A colleague on the same network as me created an identical macro which works fine.
I always get a runtime error message. I can delete the fewadditional lines but it’s a pain having to do that each time I create a macro.I am assuming its something to do with the personal xlsb but I am not sure. Anyhelp would be appreciated.


Code:
Workbooks.Open Filename:= _
        "C:\Users\Username\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.MSO\Copy of completed matters by case manager.xls"
    ActiveWindow.Visible = False
    Workbooks.Open Filename:= _
        "H:\PO KE\Reports For Rolling PIH\completed matters by case manager.xls"
    Range("A5:C18").Select
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
I have the following doubts:
- What is your colleague's code?
- Why do you have to hide the window?
- What does the error say?
- On which line does the macro stop?
- What are the additional lines that you have to delete?
 
Upvote 0

Forum statistics

Threads
1,215,459
Messages
6,124,945
Members
449,198
Latest member
MhammadishaqKhan

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