ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Application.FindFile or .GetOpenFileName? (https://www.excelbanter.com/excel-programming/357654-application-findfile-getopenfilename.html)

ewan7279

Application.FindFile or .GetOpenFileName?
 
Hi,

I have never used either of the above applications, so am unsure which to
choose. My problem:

I need a user to give the location of a text file, which then opens and is
used as a reference point for the rest of my macro (I am basically converting
text information into spreadsheet information). However, I do not want the
user to go through the text wizard to avoid upsetting the rest of the macro.

I currently get the user to type the location of the text file into a cell
of a spreadsheet, but the above applications would be more user-friendly.
Which one should I use, and what would the syntax be?

Thanks in advance,

Ewan.

NickHK

Application.FindFile or .GetOpenFileName?
 
Ewan,
Personally I always used .GetOpenFilename.
Help shows you the way.

nickHK

"ewan7279" wrote in message
...
Hi,

I have never used either of the above applications, so am unsure which to
choose. My problem:

I need a user to give the location of a text file, which then opens and is
used as a reference point for the rest of my macro (I am basically

converting
text information into spreadsheet information). However, I do not want

the
user to go through the text wizard to avoid upsetting the rest of the

macro.

I currently get the user to type the location of the text file into a cell
of a spreadsheet, but the above applications would be more user-friendly.
Which one should I use, and what would the syntax be?

Thanks in advance,

Ewan.




ewan7279

Application.FindFile or .GetOpenFileName?
 
Hi Nick,

I have read the help, but cannot actually open the file as I need to:

Sub TBTEXTOPEN()

Dim TBTEXTNAME As Variant
TBTEXTNAME = Application.GetOpenFilename("Text Files (*.txt), *.txt")
MsgBox TBTEXTNAME

End Sub

Obviously this will display the name of the file to open in a message box,
but how do I open this file without the user having to go through the text
import wizard?

Thanks,

Ewan.


"NickHK" wrote:

Ewan,
Personally I always used .GetOpenFilename.
Help shows you the way.

nickHK

"ewan7279" wrote in message
...
Hi,

I have never used either of the above applications, so am unsure which to
choose. My problem:

I need a user to give the location of a text file, which then opens and is
used as a reference point for the rest of my macro (I am basically

converting
text information into spreadsheet information). However, I do not want

the
user to go through the text wizard to avoid upsetting the rest of the

macro.

I currently get the user to type the location of the text file into a cell
of a spreadsheet, but the above applications would be more user-friendly.
Which one should I use, and what would the syntax be?

Thanks in advance,

Ewan.





ewan7279

Application.FindFile or .GetOpenFileName?
 
Nick,

I've done it. Don't know why I couldn't in the first place, but I've done
it. My coffee and sandwich must have woken up my brain...

"ewan7279" wrote:

Hi Nick,

I have read the help, but cannot actually open the file as I need to:

Sub TBTEXTOPEN()

Dim TBTEXTNAME As Variant
TBTEXTNAME = Application.GetOpenFilename("Text Files (*.txt), *.txt")
MsgBox TBTEXTNAME

End Sub

Obviously this will display the name of the file to open in a message box,
but how do I open this file without the user having to go through the text
import wizard?

Thanks,

Ewan.


"NickHK" wrote:

Ewan,
Personally I always used .GetOpenFilename.
Help shows you the way.

nickHK

"ewan7279" wrote in message
...
Hi,

I have never used either of the above applications, so am unsure which to
choose. My problem:

I need a user to give the location of a text file, which then opens and is
used as a reference point for the rest of my macro (I am basically

converting
text information into spreadsheet information). However, I do not want

the
user to go through the text wizard to avoid upsetting the rest of the

macro.

I currently get the user to type the location of the text file into a cell
of a spreadsheet, but the above applications would be more user-friendly.
Which one should I use, and what would the syntax be?

Thanks in advance,

Ewan.






All times are GMT +1. The time now is 10:30 PM.

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