Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: Open Directory for user to choose a file

  1. #11
    New Member
    Join Date
    Feb 2017
    Posts
    10
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Open Directory for user to choose a file

    Dear AlphaFrog, the Configure data wb closes as described if I choose a wb " Element List **?**", but if I choose " Element List - Export" the macro runs to its conclusion.


    ????

  2. #12
    MrExcel MVP AlphaFrog's Avatar
    Join Date
    Sep 2009
    Posts
    16,086
    Post Thanks / Like
    Mentioned
    16 Post(s)
    Tagged
    7 Thread(s)

    Default Re: Open Directory for user to choose a file

    Code:
        Dim wkb2 As Workbook, strFileName As String, FileFilter As String
        
        ChDir ThisWorkbook.Path
        
        FileFilter = "Excel 2003 (*.xls),*.xls," & _
                     "Excel 2007 > (*.xlsx),*.xlsx," & _
                     "All Excel Files (*.xl*),*.xl*," & _
                     "All Files (*.*),*.*"
        
        strFileName = Application.GetOpenFilename(FileFilter, 4, "Select One File To Open")
        If strFileName <> "False" Then
            Set wkb2 = Workbooks.Open(strFileName, False, False)
        Else
            Exit Sub 'User canceled
        End If
        
        'copy the customer name and address from the "Element List WorkSheet"
        Range("A9:A15").Copy
        With ThisWorkbook.Sheets("Cabinets")
            .Range("I3").PasteSpecial xlPasteAll
            Application.CutCopyMode = False
            .Range("I1").Value = "The Last Client that was configured was:"
        End With
        
        'Close the Element List ****.xlsm
        'wkb2.Close SaveChanges:=False
    Paste your Excel data to the forum...
    MrExcel HTML Maker or Excel Jeanie

    How to post your vba code
    [CODE]your VBA code here[/CODE]
    The # button in the forum's editor will apply CODE tags around your selected text.

  3. #13
    New Member
    Join Date
    Feb 2017
    Posts
    10
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Open Directory for user to choose a file

    Dear AlphaFrog,

    Thank you very much for your help, I appreciate the time taken to help me, and also that I have learned something.

    at my age the trick now is not to forget what I learned. hahaha

    Keep well
    best regards
    Andy

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •