+ Reply to Thread
Results 1 to 4 of 4

Multiple file opening and naming

  1. #1
    Registered User
    Join Date
    06-04-2009
    Location
    Stourbridge
    MS-Off Ver
    Excel 2013
    Posts
    26

    Multiple file opening and naming

    Hi,

    I open multiple .csv files with varying names using the following code and have stuck in a a Msg box to check the filenames, but what I want to do is give a variable name for each file as it opens, file1, file2 etc so I can use this variable to activate each file when I need it later in the code. Or is there a way to use the filenames index to do the same?

    Please advise.

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    07-03-2008
    Location
    Hyderabad, India
    MS-Off Ver
    2003 and 2007
    Posts
    58

    Re: Multiple file opening and naming

    Hi,

    Instead of using for loop, you can try with for each statement,
    Idea is,
    dim file as string

    Please Login or Register  to view this content.
    Hope its work.....

    Regards,
    Salim
    Last edited by salimudheen; 06-18-2009 at 10:07 AM.

  3. #3
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    Re: Multiple file opening and naming

    salimudheen

    Please take a couple of minutes and read ALL theForum Rules then wrap your VBA code (Rule 3)
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  4. #4
    Registered User
    Join Date
    06-04-2009
    Location
    Stourbridge
    MS-Off Ver
    Excel 2013
    Posts
    26

    Re: Multiple file opening and naming

    Hi Salim,

    Thanks for your reply. It's tidier for sure, but what I need to do is access the files individually to work on them once they are opened.

    Say I have 3 files opened how do I activate each one?

    I am assuming, because I don't know, that the files need to be given a variable name as each one is opened.

    Thanks,

    Dave

+ 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