need user input command in macro

Giganews Newsgroups
Subject: need user input command in macro
Posted by:  Phil Wagner (pmws…@yahoo.com)
Date: Sat, 26 Jul 2008

Hello -

I have a macro that works on my computer but not other user's computers who
are on a network.  I'm importing a file using the Data, Import External
Data, Import Data.  In the macro's Select Data Source screen I've indicated
I want it to look in the My Data Sources Directory and get the newdata.txt
file.

I'd like to set up the macro to ask the user to select the directory and
file in the Select Data Source screen, then continue through the rest of the
macro.

Here's the first part of the code:

' Keyboard Shortcut: Ctrl+d
'
    With ActiveSheet.QueryTables.Add(Connection:= _
        "TEXT;C:\Documents and Settings\pwagner\My Documents\My Data
Sources
ewdata.txt" _
        , Destination:=Range("A2"))
        .Name = "newdata"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .RefreshStyle = xlInsertDeleteCells

TIA for hour help!
---
Phil

Replies