Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On XP systems you could try something like this:
Sub openTXT() 'XP only Set cd = CreateObject _ ("UserAccounts.CommonDialog") cd.Filter = "Text Files|*.txt" cd.InitialDir = "C:\" If cd.ShowOpen = 0 Then Exit Sub End If Debug.Print cd.Filename End Sub -- urkec "Jim Rech" wrote: I agree that using the Excel object model just for GetOpenFilename seems overkill and requiring a user to have Excel installed for no other reason is to be avoided. Another approach is to use the Windows API. The downside is that it is a lot more complex. This site has code specifically for standalone VB6 but you could adapt it to VBA pretty easily I think. http://vbnet.mvps.org/code/comdlg/fileopendlg.htm -- Jim "Dan R." wrote in message oups.com... |I have an application that prompts the user to select a text file for | processing which is done by using the 'GetOpenFilename' from the | Microsoft Excel object library. I'm not using Excel in the program | so | I'm assuming this is probably not the best way to do this. Any | suggestions? | | inputfile = Application.GetOpenFilename( _ | fileFilter:="Text Files (*.txt),*.txt", _ | Title:="Select the file") | | Thanks, | -- Dan | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Opening text files | Excel Discussion (Misc queries) | |||
opening extensionless text files | Excel Discussion (Misc queries) | |||
Opening large text files | Excel Discussion (Misc queries) | |||
Opening text files | Excel Programming | |||
Opening text files using macro | Excel Programming |