Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default Code for bring up the file-open dialog box

Hi all,

Please share with me the code to simulate the File-Open dialog box in
VBA. Thanks so much.

Ben

--

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Code for bring up the file-open dialog box

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Code for bring up the file-open dialog box

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   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default Code for bring up the file-open dialog box

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
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
Open File Dialog box looks like Steven Excel Discussion (Misc queries) 3 January 30th 10 07:44 PM
Open Dialog Box to return Selected File Path and Not Open it. DMS Excel Programming 4 January 26th 10 12:46 PM
File Browse Function (Open dialog box for choosing file) b-123 Excel Programming 1 August 25th 05 10:06 PM
Open File Dialog Box Tha BeatMaker[_8_] Excel Programming 1 July 2nd 05 11:34 PM
open file dialog-select file-import worksheet Divinedar Excel Programming 1 January 16th 04 07:13 PM


All times are GMT +1. The time now is 11:44 PM.

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

About Us

"It's about Microsoft Excel"