Excel on custom outlook form

M

Michelle Key

I have been struggling with this for far too long. I'm having a problem
with an Excel Spreadsheet control on a custom OL '03 contact form. I
added the spreadsheet on the second page of the form. My problem is that
it appears that I can either display the spreadsheet as I've formatted
it, complete with column headers, but the users can't enter data, OR I
can allow users to enter and save data with the VBScript copied and
modified from Sue Mosher's site...

Dim XLSheet

Function Item_Open()
Set oPage = Item.GetInspector.ModifiedFormPages("Notes")
Set XLSheet = oPage.Controls("Spreadsheet1")
XLSheet.HTMLData = Item.BillingInformation
Item.Subject = Item.Subject 'Dirty the form
End Function

Function Item_Write()
Item.BillingInformation = XLSheet.HTMLData
End Function

but not both. I either get a blank spreadsheet without formatting or
headers that I can type into and save, or I get an error message that
states that the spreadsheet is locked. When I delete the code entirely,
I can see the spreadsheet as formatted, but that doesn't allow the
saving of data. I tried setting the protection of the spreadsheet AFTER
opening it up with code, but that didn't work either. I'm better at VBA
than VBS and I know I'm missing something here. What I want is for the
users to see a spreadsheet with three columns, the first row with
headers that is protected from change, and they can enter new data into
the spreadsheet and save the info when they save the contact info.

I tried to copy info in from another spreadsheet to an existing contact
that was already based on my custom form, but when I saved and closed
the form and opened it back up, the info I had copied and pasted was
gone.

I know it can be done - I even tried copying the Outlook Expense Report
example but I couldn't "design" it. (I noticed it was a different
class: IPM.DOCUMENT.EXCEL.SHEET.8, mine is IPM.CONTACT...and the name
of my form)

Could it have anything to do with HTML vs. XML?

At wits' end...
 
S

Sue Mosher [MVP-Outlook]

If you want protection, you'd need to add that after the XLSheet.HTMLData =
Item.BillingInformation statement, something like:

XLSheet.Rows(1).Locked = True
XLSheet.Protect
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top