Hi all,
Please share with me the code to simulate the File->Open dialog box in
VBA. Thanks so much.
Ben
--
Hi all,
Please share with me the code to simulate the File->Open dialog box in
VBA. Thanks so much.
Ben
--
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" <Ben@discussions.microsoft.com> wrote in message
news:5BEF1AFF-A252-4FE8-80BF-88B48F5FE820@microsoft.com...
> Hi all,
>
> Please share with me the code to simulate the File->Open dialog box in
> VBA. Thanks so much.
>
> Ben
>
> --
>
Hi Ben,
Try:
Application.Dialogs(xlDialogOpen).Show
---
Regards,
Norman
"Ben" <Ben@discussions.microsoft.com> wrote in message
news:5BEF1AFF-A252-4FE8-80BF-88B48F5FE820@microsoft.com...
> Hi all,
>
> Please share with me the code to simulate the File->Open dialog box in
> VBA. Thanks so much.
>
> Ben
>
> --
>
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
>
> --
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks