Excel VBA question

Discussion in 'Software' started by Publius, Aug 9, 2007.

  1. Publius

    Publius Sergeant

    I want to create a userForm that allows the user to choose three tab delimited files to be pasted in specific places in a spreadsheet. Here is an example of one of the pastes:
    Code:
        Workbooks.OpenText Filename:= _
            [B]"\\some network folder\someFile.txt"[/B], Origin:= _
            xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
            xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, _
            Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), _
            Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8, 1), _
            Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array(14, 1), Array(15 _
            , 1), Array(16, 1), Array(17, 1), Array(18, 1), Array(19, 1), Array(20, 1), Array(21, 1), _
            Array(22, 1), Array(23, 1), Array(24, 1), Array(25, 1))
        Range("A1:R16").Select
        Selection.Copy
        Windows("Book1").Activate
        ActiveSheet.Paste
        Windows("someFile.txt").Activate
        ActiveWorkbook.Close
    I can use a textbox to replace the "\\some network folder\someFile.txt" if the user types in the file path directly, but I want the user to be able to browse for the file and I haven't been able to figure out how to do this.

    I am only semi-competent in VBA, so be gentle with your solutions.

    I am using Excel 2000 for this example, though I have 2003 at work where it will be running.

    Any help would be appreciated.

    Thanks.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds