Help, Using VB to Open a certain type of File


Posted by Cadderly on August 21, 2001 5:36 AM

Hello,

I would like to open a window, which gives me a list of file(s) to choose from. The Files are in this format(Reports Handsort 21_08_01 Tue.xls and Reports Machines 21_08_01 Tue.xls).

I only want the Machine Files to be displayed in the list. I am using the following script.

fileToOpen = Application.GetOpenFilename("Text Files (*.txt), *.txt")

Unfortunately, I can only specify the ext and not the filename.


Cadderly
Any help would be Appreciated

Posted by Damon Ostrander on August 21, 2001 8:49 AM

Hi Cadderly,

Yes, unfortunately Mr. Gates did not see fit to allow full wildcard matching of filenames with the GetOpenFilename. However, if you really intend to open the file, not just retrieve the filename, you can use the built-in Open dialog with wildcarding:

Application.Dialogs(xlDialogOpen).Show ("*Machines*.xls")

Damon




Posted by Cadderly on August 22, 2001 2:00 AM

Thanks for the Help. Much appreciated! Hi Cadderly, Yes, unfortunately Mr. Gates did not see fit to allow full wildcard matching of filenames with the GetOpenFilename. However, if you really intend to open the file, not just retrieve the filename, you can use the built-in Open dialog with wildcarding: Application.Dialogs(xlDialogOpen).Show ("*Machines*.xls") Damon : Hello, : I would like to open a window, which gives me a list of file(s) to choose from. The Files are in this format(Reports Handsort 21_08_01 Tue.xls and Reports Machines 21_08_01 Tue.xls). : I only want the Machine Files to be displayed in the list. I am using the following script. : fileToOpen = Application.GetOpenFilename("Text Files (*.txt), *.txt") : Unfortunately, I can only specify the ext and not the filename. :