Re: CR 8.5 exporting to Excel.

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Bob Holmes (rholmes_at_REMOVEmmwec.org)
Date: 08/18/04


Date: Wed, 18 Aug 2004 07:55:26 -0400

I do that all the time. Sorry.
How's this:

    Dim objExcel As Excel.Application
    Set objExcel = New Excel.Application

    objExcel.Workbooks.Open ("c:\temp\mylockingtest.xls")

    objExcel.Cells.Select
    Selection.Locked = True
    Active***.Protect "YourPassword"
    Active***.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True

    Range("A1").Select

    ActiveWorkbook.Close savechanges:=True
    objExcel.Workbooks.Close
    Set objExcel = Nothing

--
Bob Holmes MCNGP #31
"Stephen" <stephen@stephen.com> wrote in message
news:cfv08h$6cm$1@hercules.btinternet.com...
> Hi Bob,
>
> One slight problem, as far as I can see there is no code  !!!
> Am I being blind or did you forget to attach it?
>
> Thanks
> Stephen.
>
> "Bob Holmes" <rholmes@REMOVEmmwec.org> wrote in message
> news:uiFWotFhEHA.592@TK2MSFTNGP11.phx.gbl...
> > Hi Stephen,
> >     Sorry I didn't get this to you yesterday.  Work sort of got in the
> way.
> > This little routine will open your spread***, set the protection and
> then
> > save it without the user being aware.  If someone opens the spread***,
> it
> > is already protected.  It may not be the cleanest code, but it works.
You
> > may have to add code to check for the protection already being on, if
this
> > is not a brand new file.  You might also need to change thing so that
you
> > don't accidentally shut down Excel if the user has another workbook
open.
> >
> > --
> > Bob Holmes MCNGP #31
> > "Stephen" <stephen@stephen.com> wrote in message
> > news:cfqcj1$k8j$1@hercules.btinternet.com...
> > > Through code.I use something along the lines of
> > >
> > > set crxExportOptions = Report.Exportoptions
> > > crxExportoptions.FormatType = crEFTExcel70Tabular
> > > crxExportOptions.destinationtype = crEDTDiskfile
> > > .
> > > .
> > > .
> > > .
> > > .
> > > report.export False
> > >
> > > which works nicely to give me my excel file save to the destination,
but
> > > what I really need is for this file to be uneditable,
> > > i.e. Locked *** as you would do through [ Tools -> protect *** ]
> but
> > I
> > > want to do this in the code, not manually. So as soon as the user
opens
> > the
> > > file its protected.
> > >
> > > Thanks
> > > Stephen.
> > >
> > >
> > >
> > >
> > > "Bob Holmes" <rholmes@REMOVEmmwec.org> wrote in message
> > > news:uzE8Hm4gEHA.384@TK2MSFTNGP10.phx.gbl...
> > > > Hi Stephen,
> > > >     Do you want to do this manually, or through code?
> > > >
> > > > --
> > > > Bob Holmes MCNGP #31
> > > > "Stephen" <stephen@stephen.com> wrote in message
> > > > news:cfq793$88b$1@sparta.btinternet.com...
> > > > > Hi,
> > > > >
> > > > > A quick question regarding exporting a report to Excel.
> > > > > I have written the code to export my report to excel, and it all
> works
> > > > fine,
> > > > > but now I want to be able to lock the excel *** so that none of
> the
> > > data
> > > > > is editable.
> > > > > Is this possible? if some one could help it would be appreciated.
> > > > >
> > > > > Thanks.
> > > > > Stephen.
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>

Quantcast