+ Reply to Thread
Results 1 to 4 of 4

Excel file format.

Hybrid View

  1. #1
    Tom
    Guest

    Excel file format.

    i am using the code below, i am coming in after this was already built. it
    appears that fileformat 16 will not let me password protect the sheet. is
    there a way around this? what is file format 16?
    i tried oBackLog.SaveAs(cblfile,16,12345) but the sheet was not protected.
    so im lost.

    osheet.protect("12345")
    if File(Cblfile)
    Erase(Cblfile)
    endif

    if nform = 2
    oBackLog.SaveAs(cblfile,16)
    endif
    if nform = 5
    oBackLog.SaveAs(cblfile,43,)
    endif
    if nform = 0
    oBackLog.SaveAs(cblfile,-4143)
    endif

  2. #2
    Dave Peterson
    Guest

    Re: Excel file format.

    Go into the VBE.
    Hit F2 (to see the object browser)
    search for xlfileformat

    You'll be able to click on each of the member names and see what numeric
    constant they represent.

    I saw:
    xlExcel2 = 16 (&H10)

    That sure looks like it is one early format of excel (version 2). I use xl2003
    and it's up to version 11.

    Maybe that early version of excel doesn't allow sheet protection?

    When I ran this:

    Option Explicit
    Sub testme()
    ActiveSheet.Protect Password:="hi"
    ActiveWorkbook.SaveAs Filename:="aaa.xls", FileFormat:=16
    End Sub

    I got a message back:
    Run-time error '1004':
    Sheet is protected with password. File format cannot be used.

    So that looks like a problem.

    But why, oh, why would anyone need to save to that version of excel?

    Tom wrote:
    >
    > i am using the code below, i am coming in after this was already built. it
    > appears that fileformat 16 will not let me password protect the sheet. is
    > there a way around this? what is file format 16?
    > i tried oBackLog.SaveAs(cblfile,16,12345) but the sheet was not protected.
    > so im lost.
    >
    > osheet.protect("12345")
    > if File(Cblfile)
    > Erase(Cblfile)
    > endif
    >
    > if nform = 2
    > oBackLog.SaveAs(cblfile,16)
    > endif
    > if nform = 5
    > oBackLog.SaveAs(cblfile,43,)
    > endif
    > if nform = 0
    > oBackLog.SaveAs(cblfile,-4143)
    > endif


    --

    Dave Peterson

  3. #3
    Tom
    Guest

    Re: Excel file format.

    Dave, im trying to figure out why we need to save in that version also. this
    program creates 2000 .xls sheets and emails them. i think the problem is that
    some of the folks that are reveiving them dont have the Lastest?

    thats the best answer i can give. i got the same error you did.

    whats interesting you can protect the sheet without a password,

    i fixed it and got it to work.

    thanks.

    "Dave Peterson" wrote:

    > Go into the VBE.
    > Hit F2 (to see the object browser)
    > search for xlfileformat
    >
    > You'll be able to click on each of the member names and see what numeric
    > constant they represent.
    >
    > I saw:
    > xlExcel2 = 16 (&H10)
    >
    > That sure looks like it is one early format of excel (version 2). I use xl2003
    > and it's up to version 11.
    >
    > Maybe that early version of excel doesn't allow sheet protection?
    >
    > When I ran this:
    >
    > Option Explicit
    > Sub testme()
    > ActiveSheet.Protect Password:="hi"
    > ActiveWorkbook.SaveAs Filename:="aaa.xls", FileFormat:=16
    > End Sub
    >
    > I got a message back:
    > Run-time error '1004':
    > Sheet is protected with password. File format cannot be used.
    >
    > So that looks like a problem.
    >
    > But why, oh, why would anyone need to save to that version of excel?
    >
    > Tom wrote:
    > >
    > > i am using the code below, i am coming in after this was already built. it
    > > appears that fileformat 16 will not let me password protect the sheet. is
    > > there a way around this? what is file format 16?
    > > i tried oBackLog.SaveAs(cblfile,16,12345) but the sheet was not protected.
    > > so im lost.
    > >
    > > osheet.protect("12345")
    > > if File(Cblfile)
    > > Erase(Cblfile)
    > > endif
    > >
    > > if nform = 2
    > > oBackLog.SaveAs(cblfile,16)
    > > endif
    > > if nform = 5
    > > oBackLog.SaveAs(cblfile,43,)
    > > endif
    > > if nform = 0
    > > oBackLog.SaveAs(cblfile,-4143)
    > > endif

    >
    > --
    >
    > Dave Peterson
    >


  4. #4
    Dave Peterson
    Guest

    Re: Excel file format.

    I would bet (not a lot, though <vbg>) that all your recipients have at least
    xl97.

    And the xl97 format is the same format used with xl2k, xl2002, xl2003.

    I'd send out the 2000 in xl97 format and wait for the stuff to hit that fan.

    (Heck, you could even try xl95 format if you have some real stragglers.)

    Tom wrote:
    >
    > Dave, im trying to figure out why we need to save in that version also. this
    > program creates 2000 .xls sheets and emails them. i think the problem is that
    > some of the folks that are reveiving them dont have the Lastest?
    >
    > thats the best answer i can give. i got the same error you did.
    >
    > whats interesting you can protect the sheet without a password,
    >
    > i fixed it and got it to work.
    >
    > thanks.
    >
    > "Dave Peterson" wrote:
    >
    > > Go into the VBE.
    > > Hit F2 (to see the object browser)
    > > search for xlfileformat
    > >
    > > You'll be able to click on each of the member names and see what numeric
    > > constant they represent.
    > >
    > > I saw:
    > > xlExcel2 = 16 (&H10)
    > >
    > > That sure looks like it is one early format of excel (version 2). I use xl2003
    > > and it's up to version 11.
    > >
    > > Maybe that early version of excel doesn't allow sheet protection?
    > >
    > > When I ran this:
    > >
    > > Option Explicit
    > > Sub testme()
    > > ActiveSheet.Protect Password:="hi"
    > > ActiveWorkbook.SaveAs Filename:="aaa.xls", FileFormat:=16
    > > End Sub
    > >
    > > I got a message back:
    > > Run-time error '1004':
    > > Sheet is protected with password. File format cannot be used.
    > >
    > > So that looks like a problem.
    > >
    > > But why, oh, why would anyone need to save to that version of excel?
    > >
    > > Tom wrote:
    > > >
    > > > i am using the code below, i am coming in after this was already built. it
    > > > appears that fileformat 16 will not let me password protect the sheet. is
    > > > there a way around this? what is file format 16?
    > > > i tried oBackLog.SaveAs(cblfile,16,12345) but the sheet was not protected.
    > > > so im lost.
    > > >
    > > > osheet.protect("12345")
    > > > if File(Cblfile)
    > > > Erase(Cblfile)
    > > > endif
    > > >
    > > > if nform = 2
    > > > oBackLog.SaveAs(cblfile,16)
    > > > endif
    > > > if nform = 5
    > > > oBackLog.SaveAs(cblfile,43,)
    > > > endif
    > > > if nform = 0
    > > > oBackLog.SaveAs(cblfile,-4143)
    > > > endif

    > >
    > > --
    > >
    > > Dave Peterson
    > >


    --

    Dave Peterson

+ 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