Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
Please share with me the code to simulate the File-Open dialog box in VBA. Thanks so much. Ben -- |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
this might be of use, its from the post about how to parse a text file ....
it has a open file (incl a filter for text files!), you should be able to strip out the useful bits... Brian Tom Ogilvy wrote: Sub testme2() Dim FName As String Dim FNum As Long Dim sLine As String Dim TName As Variant TName = Application.GetOpenFilename _ (fileFilter:="Text Files (*.txt),*.txt,All Files (*.*),*.*", _ Title:="Open Report") If TName = False Then MsgBox "You didn't select a file" 'Exit Sub Cleanup End End If FName = CStr(TName) FNum = FreeFile Open FName For Input As FNum Do While Not EOF(FNum) Input #FNum, sLine If InStr(1, sLine, "NUE00001 GRAND TOTALS", _ vbTextCompare) 0 Then Line Input #FNum, sLine 'Match where next line is needed Cells(3, 3).Value = sLine ElseIf InStr(1, sLine, "NUE00002 GRAND TOTALS", _ vbTextCompare) 0 Then Line Input #FNum, sLine Line Input #FNum, sLine 'Match where line 2 down is needed Cells(4, 3).Value = sLine End If Loop ' now close the file Close #FNum End Sub "Ben" wrote in message ... Hi all, Please share with me the code to simulate the File-Open dialog box in VBA. Thanks so much. Ben -- |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Ben,
Try: Application.Dialogs(xlDialogOpen).Show --- Regards, Norman "Ben" wrote in message ... Hi all, Please share with me the code to simulate the File-Open dialog box in VBA. Thanks so much. Ben -- |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you Brian and Norman.
Ben -- "Ben" wrote: Hi all, Please share with me the code to simulate the File-Open dialog box in VBA. Thanks so much. Ben -- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Open File Dialog box looks like | Excel Discussion (Misc queries) | |||
Open Dialog Box to return Selected File Path and Not Open it. | Excel Programming | |||
File Browse Function (Open dialog box for choosing file) | Excel Programming | |||
Open File Dialog Box | Excel Programming | |||
open file dialog-select file-import worksheet | Excel Programming |