+ Reply to Thread
Results 1 to 6 of 6

Macro to remove PW Protection in 2003 xls, Showing different behavior for xlsx files

  1. #1
    Registered User
    Join Date
    03-08-2013
    Location
    Derbyshire
    MS-Off Ver
    Excel 2003
    Posts
    46

    Macro to remove PW Protection in 2003 xls, Showing different behavior for xlsx files

    Hi,

    i have some files which I use a macro to PW unprotect. Ive created eerything in 2003 because mostly were dealing with people with older technology. However alot of them are coming back as xlsx files.

    I have the following



    Please Login or Register  to view this content.
    Now this works fine for xls. However xlsx files the password box comes up and you have to enter the PW manually. Then the macro goes onto complete successfully.

    Is there any way to deal with this at all. Any extra code i could add or any tips. OTher wise Im stuck with a anual process for these files

    Debbie
    Last edited by Richard Buttrey; 07-24-2013 at 07:33 AM. Reason: incorrect first code tag

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Macro to remove PW Protection in 2003 xls, Showing different behavior for xlsx files

    Hi,

    As far as I'm aware there is no difference between 2003 and 2007/2010/2013 in this respect.

    What's the whole code since your MyFile variable doesn't change in the code you've posted.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    03-08-2013
    Location
    Derbyshire
    MS-Off Ver
    Excel 2003
    Posts
    46

    Re: Macro to remove PW Protection in 2003 xls, Showing different behavior for xlsx files

    There is lots of code. i havent pasted it in here because if I enter the PW everything else runs successfully.

    its

    <CODE>Workbooks.Open Filename:=MyFile, Password:="aaa" + Left(MyFile, 4) + "ppp"</CODE>

    where it just doesnt use the password At the top I have

    <CODE>Dim MyFile As String</CODE>

    Very odd. xls is fine but xlsz and xlsm bypass the password section conpletetly.

    Ive checked the section

    <CODE>MyFile = Dir(CurDir() & "\" & "*.xls*") </CODE> (Used * at the end so it takes x or m)

    the myfile is always populated with the correct 4 digit value which is at the beginning of every file name so this seems OK?

    Im at a loss

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Macro to remove PW Protection in 2003 xls, Showing different behavior for xlsx files

    Have you tested a file that's been created in 2007 or later and saved as both a 2003 and 2007+ file. That would eliminate any compatibility problem.

    Incidentally when you wrap code in code tags, use the # icon on the forum so that they are automatically applied rather than manually adding. You're using <> whereas the forum uses []

  5. #5
    Registered User
    Join Date
    03-08-2013
    Location
    Derbyshire
    MS-Off Ver
    Excel 2003
    Posts
    46

    Re: Macro to remove PW Protection in 2003 xls, Showing different behavior for xlsx files

    I havent.

    The files are coming from lots of different sources but the original file that was sent to everyone was created in 2003.

    Thanks for the advice re the code blocs

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Macro to remove PW Protection in 2003 xls, Showing different behavior for xlsx files

    Quote Originally Posted by DebbieEdwards View Post
    I havent.

    The files are coming from lots of different sources but the original file that was sent to everyone was created in 2003.

    Thanks for the advice re the code blocs
    Worth trying. It's unlikely but possible I suppose that there's some difference in this area with a .xls 97/2003 file created with 97/2003 and a .xls file created from XL 2007+

    Let us know how this test goes.

+ 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] Remove asking box when saving macro as .xlsx
    By impresxy in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-28-2013, 05:24 AM
  2. [SOLVED] how to convert multiple .txt files to .xlsx files using a macro?
    By Aaron_Tram in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-21-2013, 06:30 PM
  3. excel 2003 with .xlsx files
    By itsjojo in forum Excel General
    Replies: 0
    Last Post: 04-18-2011, 08:35 AM
  4. HOW DO I CONVERT XLSX FILES BACK TO EXCEL 2003?
    By vei in forum Excel General
    Replies: 5
    Last Post: 07-10-2006, 04:34 PM
  5. modify xlsx files with excel 2003
    By mallorypr in forum Excel General
    Replies: 0
    Last Post: 07-10-2006, 10:19 AM

Tags for this Thread

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