Excel Object Model

  • Thread starter Thread starter MM
  • Start date Start date
M

MM

Thanks Bryan,

I'm not familiar w/ how to use the Excel Object model. Could you brief me
or give me a location to study up on it?

Melanie


From: "Bryan Reich [MSFT]" <[email protected]>
Subject: Re: password protect excel spreadsheet through access macro
Date: Tuesday, February 10, 2004 4:41 PM

You won't be able to do this in one step through SendObject. You'll have to
create the excel file (through OutputTo for example), then use the Excel
object model to access the document and change it's properties, then send
the file as an attachment (through the outlook O.M. most likely). The other
option you could do if it fits your scenario is publish the documents to a
password protected share or shares and allow access to them that way.
 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_xl2003_ta/html/odc_super.asp
This URL is the MSDN starting point for coding against the object model in
Excel.
Now, it's written assuming you are actually writing your code in Excel. You
won't be, so not everything will apply directly exactly as written, but you
will get at Excel in the following way inside of Access:

Dim myExcel as Excel.Application

Set myExcel = CreateObject("Excel.Application")

myExcel.CALL_THE_EXCEL_OBJECT_MODEL_THROUGH_THIS

So all the excel operations you can perform through it's object model will
be available to you through this Excel application object, which should
allow you to open up the document, get to it's properties and change them,
and then save the document again. Lastly, don't forget to quit Excel when
you're done with the object
myExcel.Quit()
Set myExcel = Nothing
Hope this gives you a place to start from. Let me know if you have further
questions.
--
Bryan
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


MM said:
Thanks Bryan,

I'm not familiar w/ how to use the Excel Object model. Could you brief me
or give me a location to study up on it?

Melanie


From: "Bryan Reich [MSFT]" <[email protected]>
Subject: Re: password protect excel spreadsheet through access macro
Date: Tuesday, February 10, 2004 4:41 PM

You won't be able to do this in one step through SendObject. You'll have to
create the excel file (through OutputTo for example), then use the Excel
object model to access the document and change it's properties, then send
the file as an attachment (through the outlook O.M. most likely). The other
option you could do if it fits your scenario is publish the documents to a
password protected share or shares and allow access to them that way.
--
Bryan Reich
Microsoft Office
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


MM said:
Hi all,

I'm looking for a way to password protect the excel spreadsheets currently
created in a send object macro w/i access.

Currently, I use a macro to open a report based on a query filter. Then I
use send object to send the report in excel via email.

I'm looking for an automated way to password protect the excel files before
sending them.

Thanks!
 
Back
Top