Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open a dinamic Excel Document

Status
Not open for further replies.

remeng

Technical User
Jul 27, 2006
523
US
Hi all!

Got a quick question.

I am attempting to import 3 columns from a different worksheet and I need to promt the user as to where the file is located and what the file's name is. I have looked at the woorbooks.open () command but it requires me to place a file name, which like I said will change from run to run. Is there a way to create the open / browse window to appear so that the user can select the document or something similar?

Thanks!
 
Google Searches:
[google]excel vba browse dialog[/google]
[google]excel vba browse path dialog[/google]
[google]excel vba path select dialog[/google]

Tip: To find hits here on Tek-Tips, add
[tab]site:Tek-tips.com
to a search

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 




Check out the GetOpenFilename method of the application object.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
So I attempted this:

Sub autofilter2()

Dim lngCount As Long

' Open the file dialog
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = True
.Show

End With

Workbooks.Open (lngCount)

End Sub

I am having the small problem of the document opening. I'm new to VBA so could someone explain where I went wrong. Thanks.
 



Why didn't you copy & USE the entire HELP Example?
Code:
Sub autofilter2()

    Dim lngCount As Long

    ' Open the file dialog
    With Application.FileDialog(msoFileDialogOpen)
        .AllowMultiSelect = True
        .Show[b]
        ' Display paths of each file selected
        For lngCount = 1 To .SelectedItems.Count[red]
'I merely substituted the OPEN for the msgbox
            Workbooks.Open .SelectedItems(lngCount)[/red]
        Next lngCount[/b]
    End With


End Sub

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top