i'm stuck!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • timkenx
    New Member
    • Dec 2006
    • 4

    i'm stuck!

    Hi guys, I desperately need a program that will open a password protected excel file and then save it as a none password protected file.

    Problem is perl is not letting me do that so I've turned to VB. I don't know ANY VB so haven't got a clue where to start and haven't got time to learn it...

    Anyone know where there may be code for this/similar code. Or does anyone want to write some code? ;-)

    Thanks, A helpless noob.
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Originally posted by timkenx
    Hi guys, I desperately need a program that will open a password protected excel file and then save it as a none password protected file.

    Problem is perl is not letting me do that so I've turned to VB. I don't know ANY VB so haven't got a clue where to start and haven't got time to learn it...

    Anyone know where there may be code for this/similar code. Or does anyone want to write some code? ;)
    Quick question - do you mean that you want it to work without knowing the password? Or will you splly the password? I'm no expert on this, but I'd say it's likely to make a big difference.

    Also, what version of VB?

    (Note, it might be easier to throw the program together using the VBA editor built into Excel.)

    Comment

    • timkenx
      New Member
      • Dec 2006
      • 4

      #3
      Well I know the password, I just need to be able to open the excel file, copy all the data to a new excel file and then save it (hence having an identical file that isn't password protected) Then I'll use perl to play with the excel file.

      My main problem is that there is no way to open a file in perl that is password protected, so I have to open it in VB (whichever version) and then save a non-password protected file. Bit long winded but I don't know any other way!

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Originally posted by timkenx
        Well I know the password, I just need to be able to open the excel file, copy all the data to a new excel file and then save it (hence having an identical file that isn't password protected) Then I'll use perl to play with the excel file.

        My main problem is that there is no way to open a file in perl that is password protected, so I have to open it in VB (whichever version) and then save a non-password protected file. Bit long winded but I don't know any other way!
        So would it be enough to simply open the spreadsheet and save it (perhaps under a new name) without the password? Or do you actually need to copy the data to another spreadsheet? The open/save seems likely to be simpler.

        Here's a sample macro I recorded in Excel, saving a spreadsheet without password...
        Code:
        Sub SaveUnprotected()
          ActiveWorkbook.SaveAs Filename:= _
            "C:\Documents and Settings\<[I]username[/I]>\My Documents\rrrr.xls", FileFormat:=xlNormal _
            , Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
            CreateBackup:=False
        End Sub
        Is this any help?

        Comment

        Working...