ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Get Open File Name (https://www.excelbanter.com/excel-programming/302954-get-open-file-name.html)

kiza[_9_]

Get Open File Name
 
Hi,

I am trying to open a file from a folder but at the moment, not havin
much sucess. I have written the following VB code:

fileToOpen = Application _
.GetOpenFilename("Text Files (*.txt), *.txt")
If fileToOpen < False Then
MsgBox "Open " & fileToOpen
End If

However, this only allows me to select Text Files and I am mainl
interested in .xls files. I have managed to get the folder box open bu
I cannot open any Excel files.

Have I missed something out?

If there is any one who can help me in my quest, that would be cool.
Thanks
Kiz

--
Message posted from http://www.ExcelForum.com


mudraker[_290_]

Get Open File Name
 
Kiza


try

fileToOpen = Application _
.GetOpenFilename("Excel Files (*.xls), *.xls")
If fileToOpen < False Then
MsgBox "Open " & fileToOpen
End I

--
Message posted from http://www.ExcelForum.com


NooK[_24_]

Get Open File Name
 
Just to explain, the first argument on the open filename function shoul
be like that:

"Text_to_appear_at_the_bottom, Filter"


So if you want to open .doc files you'll use

"Word Documents (*.doc), *.doc"

Hope that helps.

Best Regards

Noo

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 03:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com