bring GetOpenFIleName Dialog to front

Hector H

Registered User.
Local time
Today, 02:20
Joined
Jun 25, 2009
Messages
17
I used GetOpenFIleName() to retrive a file name but the problem is that the dialog box does not come to the front. The only way I can see it is by using ALt +Tab. How can I bring the dialog box to the topmost window.

Dim xlTmp As Excel.Application
Set xlTmp = New Excel.Application
FileToImport As String

FileToImport = xlTmp.GetOpenFilename("Area Summary (*.csv), *.csv", , _
"Please select Area data file")

Thanks
 
Thanks for reply. I looked into that but am not that familar with VB and I wanted to return a string. I got it workinging I just made
xlTmp.Visible = true
 
Try:
Code:
[COLOR=navy]Dim[/COLOR] fd [COLOR=navy]As[/COLOR] FileDialog
[COLOR=navy]Dim[/COLOR] FileToImport [COLOR=navy]As String[/COLOR]
[COLOR=navy]Dim[/COLOR] var [COLOR=navy]As Variant[/COLOR]
 
[COLOR=navy]Set[/COLOR] fd = Application.FileDialog(msoFileDialogOpen)
[COLOR=navy]With[/COLOR] fd
    .AllowMultiSelect = False
    .Show
    [COLOR=navy]For Each[/COLOR] var [COLOR=navy]In[/COLOR] .SelectedItems
        FileToImport = var
    [COLOR=navy]Next[/COLOR]
[COLOR=navy]End With[/COLOR]
 
ByteMyzer, you are my hero. That worked perfectly. It was so consise that a novice like me could duplicate.
 

Users who are viewing this thread

Back
Top Bottom