+ Reply to Thread
Results 1 to 8 of 8

VBA File Extension

  1. #1
    Registered User
    Join Date
    10-01-2007
    Posts
    49

    VBA File Extension

    I've got a macro that I've pieced together from different sources on the web designed to combine a lot of excel workbooks with single worksheets into one workbook with many worksheets. My problem is, the extension used in the VBA is .xls, causing me to have to go in manually each time the extension is something else, say, .xlsx, and change the code before I can put the files together.

    Does anyone know how to make this tweak so that I can have multiple file extensions automatically checked? Maybe even a list of them could be added to the first sheet under Accepted File Extensions so that someone else who was using it could add theirs if it wasn't already in the list without having to open up the VB editor?

    I've attached the file. Thanks

    ******EDIT******

    It doesn't seem to work at all when I go from .xls to .xlsx, although .dat and .rep both work. Not sure what causes this either.
    Attached Files Attached Files
    Last edited by chbrandt; 08-02-2010 at 06:26 PM.

  2. #2
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: VBA File Extension Problem

    chbrandt,


    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).


    Please Login or Register  to view this content.
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  3. #3
    Registered User
    Join Date
    10-01-2007
    Posts
    49

    Re: VBA File Extension

    Thanks for your help. Unfortunately, this fix didn't work, I'm getting the same error with that as I was getting when I tried .xlsx. Is it because of the vbNormal? Something with the newer version excel file is causing it not to work. Any ideas?

    Thanks in advance.

  4. #4
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: VBA File Extension

    chbrandt,


    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).


    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-01-2007
    Posts
    49

    Re: VBA File Extension

    Still getting Error 400 with an OK and HELP option, and haven't been able to figure it out from there. Have you tried experimenting with the file? Thanks

  6. #6
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: VBA File Extension

    chbrandt,

    Please Login or Register  to view this content.

    When I changed the file extensions of the workbooks to something else, the macro did not error out, and no files were processed.
    Last edited by stanleydgromjr; 08-02-2010 at 11:01 PM.

  7. #7
    Registered User
    Join Date
    10-01-2007
    Posts
    49

    Re: VBA File Extension

    Thanks a lot, I figured out that it was something to do with the actual files I was trying to open and merge. Thanks again.

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: VBA File Extension

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ 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