Some easy Wildcard Questions

Will S

Board Regular
Joined
Oct 29, 2013
Messages
69
So I've been messing around with a code that opens another file in the same folder as my sheet. I was wondering if it was possible to use a wildcard when opening the file.

This is the code I'm using, it's been stitched together from other things I've seen online so I'm not going to say I'm any expert on how to use ".Open" to it's full effect but I know it works when I don't use the wildcard and just have the film name in fully.

I've had a few thoughts on why it's coming up with "application undefined error." but other than randomly experimenting I've got no real ideas, can anyone point me in the right direction?

Code:
Sub test()
Dim CertFile As Workbook
Set CertFile = Workbooks.Open(ThisWorkbook.Path & "\1635-01-00 Rev*", False)
End Sub

Also, if I do get this code working, what would happen in the case of two files being similar, but one ends in something like "...Rev 8" and the other in "...Rev 17" What would it go for then, or would it open both?
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Don't think the Open Method allows the use of wildcards. Have a look at the Dir Function which allows the use of wildcards.
 
Upvote 0

Forum statistics

Threads
1,215,353
Messages
6,124,464
Members
449,163
Latest member
kshealy

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