+ Reply to Thread
Results 1 to 2 of 2

how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder?

  1. #1
    Raven
    Guest

    how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder?

    how can I specific a folder with wildcard criteria and excel will
    import all the correct files in that folder?

    I am completely new to macro programming. After doing a little research
    I found out that GetOpenFilename or GetFileList may be able to do
    similiar job. But I don't exactly know how to use getopenfilename and
    getfilelist doesnt seem to be an valid function in exceel 2003. May you
    give me a little instruction? Do you know any online library that gives
    detailed explanations of most excel VBA functions?? Thanks.


  2. #2
    Dave Peterson
    Guest

    Re: how can I specific a folder with wildcard criteria and excel willimport all the correct files in that folder?

    Without using wild cards, you can search for the files you want and select as
    many "correct" files as you need--just click on the first and ctrl-click on
    subsequent:


    Option Explicit
    Sub testme01()

    Dim myFileNames As Variant
    Dim wkbk As Workbook
    Dim fCtr As Long

    myFileNames = Application.GetOpenFilename("Excel Files, *.xls", _
    MultiSelect:=True)

    If IsArray(myFileNames) = False Then
    Exit Sub
    End If

    For fCtr = LBound(myFileNames) To UBound(myFileNames)
    Set wkbk = Workbooks.Open(FileName:=myFileNames(fCtr))
    'do some things
    wkbk.Close savechanges:=True 'or False???
    Next fCtr

    End Sub


    Raven wrote:
    >
    > how can I specific a folder with wildcard criteria and excel will
    > import all the correct files in that folder?
    >
    > I am completely new to macro programming. After doing a little research
    > I found out that GetOpenFilename or GetFileList may be able to do
    > similiar job. But I don't exactly know how to use getopenfilename and
    > getfilelist doesnt seem to be an valid function in exceel 2003. May you
    > give me a little instruction? Do you know any online library that gives
    > detailed explanations of most excel VBA functions?? Thanks.


    --

    Dave Peterson

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1