+ Reply to Thread
Results 1 to 6 of 6

Renaming file extensions

  1. #1
    Forum Contributor
    Join Date
    11-23-2004
    Location
    Bristol
    MS-Off Ver
    2016
    Posts
    225

    Renaming file extensions

    Hi all, I am having trouble trying to get VBA to change the file extension if the file extension is found to be capital letters.

    I have folders containing Adobe pdf files, most are .pdf which my code can see but any remaining .PDF files, my code wont see.

    I have attached the code below and can list all the files which are capital extensions, the trouble is trying to get those back as non capitals.

    Please Login or Register  to view this content.
    Any help would be appreciated.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Renaming file extensions

    Try putting the file extension in upper case in the If statement.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    11-23-2004
    Location
    Bristol
    MS-Off Ver
    2016
    Posts
    225

    Re: Renaming file extensions

    Hi Norie,

    Thanks for your reply, I tried your advice but it wasn't that line I am having the issue with, its this one.

    Please Login or Register  to view this content.
    I'm trying to rename the extension i.e: C:\Test.PDF to C:\Test.pdf

    The code finds the instances where the files have capital extension letters without issue but when it finds them I want to rename the file extension from capital extension to lower case.

    Hopefully this makes sense.

    Alan

  4. #4
    Forum Contributor
    Join Date
    11-23-2004
    Location
    Bristol
    MS-Off Ver
    2016
    Posts
    225

    Re: Renaming file extensions

    SOLVED

    Here is the code I used to re-write the file extension if its found to be capital letters.

    Please Login or Register  to view this content.

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Renaming file extensions

    Glad you got it sorted.

    Just curious though, why do you want to change the case of the file extensions?

    I always thought Windows was kind of case insensitive when it came to file extensions anyway.

  6. #6
    Forum Contributor
    Join Date
    11-23-2004
    Location
    Bristol
    MS-Off Ver
    2016
    Posts
    225

    Re: Renaming file extensions

    Windows does open pdf and PDF as normal and with Adobe, my file is shared between many users across a VPN and imports all the contents of a folder into a spread sheet to compare files, all the users can dump their files which are then added to the database.
    To only import specific files, you can toggle which files by extension you are interested in, in my case its pdf.
    When some users add their files, if they are PDF my program wont add them so wanted a way to rename PDF to pdf automatically.

    Just been using the macro across a network to change file extensions on another machine or server and have altered the code, it also skips files which may be open by network users too.

    If anybody is interested in renaming file extensions from uppercase to lowercase, this code works great.

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] File Extensions
    By 1vision in forum Excel General
    Replies: 4
    Last Post: 05-19-2014, 04:35 PM
  2. Changing File Extensions.
    By Faith Wheeler in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-12-2013, 02:45 PM
  3. [SOLVED] Removing file extensions
    By m.raby in forum Excel General
    Replies: 3
    Last Post: 07-19-2012, 11:34 AM
  4. File Open with two extensions
    By c.vaibhav in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-05-2011, 03:36 AM
  5. file extensions
    By dottiea in forum Excel General
    Replies: 1
    Last Post: 07-27-2006, 11:20 AM
  6. File Extensions
    By Robin Clay in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-25-2006, 11:55 PM
  7. [SOLVED] XML file extensions
    By Rowan in forum Excel General
    Replies: 2
    Last Post: 04-22-2005, 03:06 AM

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