excel not finding file with *

jordanburch

Active Member
Joined
Jun 10, 2016
Messages
440
Office Version
  1. 2016
Hey everyone

I have the following path.

Workbooks.Open ("K:\SHARED\TRANSFER\Enterprise Wide Suspense Initiative\Source Files\CRIS\" & ThisWorkbook.Worksheets("Variables").Range("A4").Value & "\" & Left(ThisWorkbook.Worksheets("Variables").Range("A1").Value, 6) & "\" & "*.xlsx")

The path looks just fine and works on a different month, however this month it just says it cant find that file and shows it with the above path and the *.xlsx like the file should be named *.xlsx vs the acutal file name. Its the only file inside that path and I want it to open that file and just put the * it seemed to work before but now it doesnt that I tried it in a new month. Any ideas?
 
That sounds as though the file cannot be found in the specified path.
 
Upvote 0

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
That sounds as though the file cannot be found in the specified pa
K:\SHARED\TRANSFER\Enterprise Wide Suspense Initiative\Source Files\CRIS\FY21\04-January

CRIS TI97 3875 JAN 2020

so thats the path and it looks correct. doesnt the path have to be correct since im not referencing the file in the code directly?

The file name seems to be correct. I did open it and it worked fine.
 
Upvote 0
In order to open the file you have to supply the full file path & workbook name, including the extension.
 
Upvote 0
In order to open the file you have to supply the full file path & workbook name, including the extension.
so I did a hybrid of the two suggestions and it worked here it is. Its weird because I dont reference the filename itself it just knows to pull it. Thanks for you help Fluff!

VBA Code:
Sub CRISimport()
Dim wb As Workbook



 Workbooks.Open ("K:\SHARED\TRANSFER\Enterprise Wide Suspense Initiative\Source Files\CRIS\" & ThisWorkbook.Worksheets("Variables").Range("A4").Value & "\" & Left(ThisWorkbook.Worksheets("Variables").Range("A1").Value, 3) & ThisWorkbook.Worksheets("Variables").Range("A11").Value & "\" & "*.xlsx")
 

     Sheets("3875 Indy").Select
    Sheets("3875 Indy").Copy After:=Workbooks("Suspense automation.xlsm").Sheets(2)
 
End Sub
 
Upvote 0
Glad you sorted it & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,692
Members
448,979
Latest member
DET4492

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