VBA open file with w/card MSO 2010 XP

Hake

New Member
Joined
May 23, 2012
Messages
5
Hi.
Newbie - but can't find an answer anywhere.

I have spreadsheet that saves file as 'c5016-custname-custcode.xlsm'
The 'c5016' is generated as a sequential number every time.

My aim is for warehouse staff to type '5016' into a cell and Excel will open the file.

The below code is very basic
Workbooks.Open Filename:="C:\00000\" & Range("i1") & ".xlsm", ReadOnly:=True

Cell i1 contains ="?"A1&"*"

It doesn't work. But if I find the actual file, 'F2' and add any char into the filename, then press enter. (basically just renaming the file as new name), It then works.

Thinking that it might only be machine specific - I have tried running the File Open code on another machine on the network - it works.
I've tried on Win 7 - same method works.

It doesn't make any difference if the original file ('c5016-custname-custcode.xlsm') is generated by MSO2007, 2010 or XP Win7.

However the VBA code must be run on MSO 2010 for this to happen. On 2007 it just interprets the wildcard as a character.

Any explanation would be great.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,141,069
Messages
5,704,111
Members
421,327
Latest member
Msh

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
Top