Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Get Open File Name

I am writing a macro in VB but need to open a folder rather than
specific file. As the file is unknown but its location is known.

Is there anyone who could assist me with the GET OPEN FILE NAM
function which will enable me to have a message box from which I ca
choose the relevent file?

Many Thanks In Advance
Kiz

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Get Open File Name

I have come up with the following piece of VB Coding but am still havin
a few problems as I cannot open any files with it.

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

For some reason, I cannot open any files with this coding.

Is there any one who could assist me with this query?
Thank

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Get Open File Name

Once you get the name of the file, you have to use:

Workbooks.Open fileToOpen

to actually do the open.

--
Jim Rech
Excel MVP
"kiza " wrote in message
...
|I have come up with the following piece of VB Coding but am still having
| a few problems as I cannot open any files with it.
|
| fileToOpen = Application _
| GetOpenFilename("Text Files (*.txt), *.txt")
| If fileToOpen < False Then
| MsgBox "Open " & fileToOpen
| End If
|
| For some reason, I cannot open any files with this coding.
|
| Is there any one who could assist me with this query?
| Thanks
|
|
| ---
| Message posted from http://www.ExcelForum.com/
|


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Get Open File Name

kiza

I have enclosed the full code for opening a text file using tab as th
column seperator

to change the column seperater to a comma as in a CSV file then chang
Tab:=True to Tab:=False
and Comma:=False to Comma:=True



Sub OpenUserFile()
Dim FileToOpen As Variant

FileToOpen = Application _
.GetOpenFilename("Text Files (*.txt), *.txt")
If FileToOpen = False Then
Exit Sub

End If

MsgBox "Open " & FileToOpen
Workbooks.OpenText FileName:=FileToOpen, Origin:=xlWindows _
, StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=Fals
_
, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1)

End Su

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to open a 82 KB XLSM file due to "Too many different cellformats" & "Converter failed to open the file." errors. Phillip Pi Excel Discussion (Misc queries) 0 April 23rd 09 08:53 PM
Unable to open a 82 KB XLSM file due to "Too many different cellformats" & "Converter failed to open the file." errors. Phillip Pi Setting up and Configuration of Excel 0 April 23rd 09 08:53 PM
excel 2003 saved file will not open without a blank workbook open Bob Excel Discussion (Misc queries) 4 November 11th 06 04:24 PM
In Excel - Use Windows Explorer instead of File Open to open file KymY Excel Discussion (Misc queries) 1 August 5th 06 09:59 PM
file open via IE hyperlink causes already open files to shrink and tile Marc Setting up and Configuration of Excel 0 May 4th 05 08:13 PM


All times are GMT +1. The time now is 02:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"