Welcome to the { mindfrost82.com } forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > MS Office > Excel

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-23-2008, 03:45 PM
Georges
 
Posts: n/a
Protect an excel spreasheet by script in LotusNotes

In a LotusNotes dB I Create a spreadsheet from a view with the use
of 'CreateObject("Excel.Application")'
Can someone explain me how it is possible to protect the sheet(s)
created via script?
I need to avoid anyone to change anything in the spreasheet, even the
usage of the Save As if possible.
Thanks, Georges
Reply With Quote
  #2 (permalink)  
Old 07-24-2008, 08:48 PM
Jens Seiler
 
Posts: n/a
Re: Protect an excel spreasheet by script in LotusNotes

Georges wrote:
> [...]
> Can someone explain me how it is possible to protect the sheet(s)
> created via script?
> [..]


While I don't know the direct answer to your question you can always
help yourself by simply recording a macro whily you do the action in
question manually yourself and then looking at the code created by the
macro recorder.

Greetings,
Jens Seiler
--
man mailt sich
mailto:mail@jens-seiler.de - ICQ# 24778881
http://www.jens-seiler.de
Reply With Quote
  #3 (permalink)  
Old 07-24-2008, 09:36 PM
Harlan Grove
 
Posts: n/a
Re: Protect an excel spreasheet by script in LotusNotes

Georges <georges.rob...@gmail.com> wrote...
>In a LotusNotes dB I Create a spreadsheet from a view with the use
>of *'CreateObject("Excel.Application")'

...

CreateObject is a function call and should return an Excel application
object referring to a running instance of Excel when successful.
Presumably you're assigning its result to a variable of type Object.
If so, and if there were only one workbook open in that Excel
instance, you could protect each worksheet and the workbook using code
similar to the following.


'NOTE: LotusScript code, **NOT** VBA code
Sub foo
Dim xl As Variant, wb As Variant

'possibly other code here

Set xl = createobject("Excel.Application")
Set wb = xl.workbooks.add

'possibly other code here

'note: Lotus was BRAINDEAD when they designed LotusScript
'Forall loop variables must be UNDECLARED when used,
'thus ws wasn't declared above
Forall ws In wb.Worksheets
'different passwords for different worksheets
'left as an exercise
ws.Protect "your worksheet password here"
End Forall

'possibly other code here

wb.Protect "your workbook password here", True, True

wb.SaveAs "your filename here", , _
"your file open password here", _
"your file modify password here", True

wb.close False

'possibly other code here

xl.Quit

'possibly other code here

End Sub
Reply With Quote
  #4 (permalink)  
Old 07-29-2008, 12:11 PM
Georges
 
Posts: n/a
Re: Protect an excel spreasheet by script in LotusNotes

Thanks Harlan, I will try
Georges






On 24 juil, 22:36, Harlan Grove <hrln...@gmail.com> wrote:
> Georges <georges.rob...@gmail.com> wrote...
> >In a LotusNotes dB I Create a spreadsheet from a view with the use
> >of *'CreateObject("Excel.Application")'

>
> ...
>
> CreateObject is a function call and should return an Excel application
> object referring to a running instance of Excel when successful.
> Presumably you're assigning its result to a variable of type Object.
> If so, and if there were only one workbook open in that Excel
> instance, you could protect each worksheet and the workbook using code
> similar to the following.
>
> 'NOTE: LotusScript code, **NOT** VBA code
> Sub foo
> * * * * Dim xl As Variant, wb As Variant
>
> * * * * 'possibly other code here
>
> * * * * Set xl = createobject("Excel.Application")
> * * * * Set wb = xl.workbooks.add
>
> * * * * 'possibly other code here
>
> * * * * 'note: Lotus was BRAINDEAD when they designed LotusScript
> * * * * 'Forall loop variables must be UNDECLARED when used,
> * * * * 'thus ws wasn't declared above
> * * * * Forall ws In wb.Worksheets
> * * * * * * * * 'different passwords for different worksheets
> * * * * * * * * 'left as an exercise
> * * * * * * * * ws.Protect "your worksheet password here"
> * * * * End Forall
>
> * * * * 'possibly other code here
>
> * * * * wb.Protect "your workbook password here", True, True
>
> * * * * wb.SaveAs "your filename here", , _
> * * * * * "your file open password here", _
> * * * * * "your file modify password here", True
>
> * * * * wb.close False
>
> * * * * 'possibly other code here
>
> * * * * xl.Quit
>
> * * * * 'possibly other code here
>
> End Sub


Reply With Quote
  #5 (permalink)  
Old 07-29-2008, 03:30 PM
Georges
 
Posts: n/a
Re: Protect an excel spreasheet by script in LotusNotes

Huuum
the code is not saved by LN.

I receive the message 'Protect is not sub or a function name'

did I miss something?

Georges

On 29 juil, 13:11, Georges <georges.rob...@gmail.com> wrote:
> Thanks Harlan, * I will try
> Georges
>
> On 24 juil, 22:36, Harlan Grove <hrln...@gmail.com> wrote:
>
>
>
> > Georges <georges.rob...@gmail.com> wrote...
> > >In a LotusNotes dB I Create a spreadsheet from a view with the use
> > >of *'CreateObject("Excel.Application")'

>
> > ...

>
> > CreateObject is a function call and should return an Excel application
> > object referring to a running instance of Excel when successful.
> > Presumably you're assigning its result to a variable of type Object.
> > If so, and if there were only one workbook open in that Excel
> > instance, you could protect each worksheet and the workbook using code
> > similar to the following.

>
> > 'NOTE: LotusScript code, **NOT** VBA code
> > Sub foo
> > * * * * Dim xl As Variant, wb As Variant

>
> > * * * * 'possibly other code here

>
> > * * * * Set xl = createobject("Excel.Application")
> > * * * * Set wb = xl.workbooks.add

>
> > * * * * 'possibly other code here

>
> > * * * * 'note: Lotus was BRAINDEAD when they designed LotusScript
> > * * * * 'Forall loop variables must be UNDECLARED when used,
> > * * * * 'thus ws wasn't declared above
> > * * * * Forall ws In wb.Worksheets
> > * * * * * * * * 'different passwords for different worksheets
> > * * * * * * * * 'left as an exercise
> > * * * * * * * * ws.Protect "your worksheet password here"
> > * * * * End Forall

>
> > * * * * 'possibly other code here

>
> > * * * * wb.Protect "your workbook password here", True, True

>
> > * * * * wb.SaveAs "your filename here", , _
> > * * * * * "your file open password here", _
> > * * * * * "your file modify password here", True

>
> > * * * * wb.close False

>
> > * * * * 'possibly other code here

>
> > * * * * xl.Quit

>
> > * * * * 'possibly other code here

>
> > End Sub- Masquer le texte des messages précédents -

>
> - Afficher le texte des messages précédents -


Reply With Quote
  #6 (permalink)  
Old 08-06-2008, 09:13 PM
GMAN221
 
Posts: n/a
Re: Protect an excel spreasheet by script in LotusNotes

On Jul 29, 10:30*am, Georges <georges.rob...@gmail.com> wrote:
> Huuum
> the code is not saved by LN.
>
> I receive the message * *'Protect is not sub or a function name'
>
> did I miss something?
>
> Georges
>
> On 29 juil, 13:11, Georges <georges.rob...@gmail.com> wrote:
>
> > Thanks Harlan, * I will try
> > Georges

>
> > On 24 juil, 22:36, Harlan Grove <hrln...@gmail.com> wrote:

>
> > > Georges <georges.rob...@gmail.com> wrote...
> > > >In a LotusNotes dB I Create a spreadsheet from a view with the use
> > > >of *'CreateObject("Excel.Application")'

>
> > > ...

>
> > > CreateObject is a function call and should return an Excel application
> > > object referring to a running instance of Excel when successful.
> > > Presumably you're assigning its result to a variable of type Object.
> > > If so, and if there were only one workbook open in that Excel
> > > instance, you could protect each worksheet and the workbook using code
> > > similar to the following.

>
> > > 'NOTE: LotusScript code, **NOT** VBA code
> > > Sub foo
> > > * * * * Dim xl As Variant, wb As Variant

>
> > > * * * * 'possibly other code here

>
> > > * * * * Set xl = createobject("Excel.Application")
> > > * * * * Set wb = xl.workbooks.add

>
> > > * * * * 'possibly other code here

>
> > > * * * * 'note: Lotus was BRAINDEAD when they designed LotusScript
> > > * * * * 'Forall loop variables must be UNDECLARED when used,
> > > * * * * 'thus ws wasn't declared above
> > > * * * * Forall ws In wb.Worksheets
> > > * * * * * * * * 'different passwords for different worksheets
> > > * * * * * * * * 'left as an exercise
> > > * * * * * * * * ws.Protect "your worksheet password here"
> > > * * * * End Forall

>
> > > * * * * 'possibly other code here

>
> > > * * * * wb.Protect "your workbook password here", True, True

>
> > > * * * * wb.SaveAs "your filename here", , _
> > > * * * * * "your file open password here", _
> > > * * * * * "your file modify password here", True

>
> > > * * * * wb.close False

>
> > > * * * * 'possibly other code here

>
> > > * * * * xl.Quit

>
> > > * * * * 'possibly other code here

>
> > > End Sub- Masquer le texte des messages précédents -

>
> > - Afficher le texte des messages précédents -


George,

I have spent many years writing script to both export and import data
too and from Lotus Notes Notes to Excel. The best piece of advice
that I can give you is launch Excel. Turn on the Macro to record your
actions. Go through the motions to protect the spreadsheet and/or
workbook. Stop the recording and then view what the macro recorded.
Next you will need to take this code into Notes and paste it into your
script. Sure enough you will need to make some modifications, but
they should be minimal. That should do it!

Take care and good luck.
Reply With Quote
Reply

  { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > MS Office > Excel


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 03:59 AM.


Powered by vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
© 1999-2008 mindfrost82.com v11.0


Sponsors:
Loans | Equity Release | Credit Score | MPAA | Mortgages



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114