View Single Post
  #9  
Old October 21st 08, 01:13 PM posted to microsoft.public.outlook.program_forms
IT Girl[_2_]
external usenet poster
 
Posts: 8
Default HTMLData property for XLSpreadsheet in contracts form

I have made the corrections you noted. But I am still getiing the the same
script error when I open the contact and then when I update the information,
save and close I get another error of - Object required: 'XLSheet' Line No.
11. Did I miss something Sue?

Here's the code again.

Dim XLSheet

Function Item_Open()
Set oPage = Item.GetInspector.ModifiedFormPages("Tab2")
Set XLSheet = oPage.Controls("Spreadsheet1")
XLSheet.HTMLData = Item.Body
Item.Subject = Trim(Item.Subject & " ") 'Dirty the form
End Function

Function Item_Write()
Item.Body("XLSheet") = XLSheet.HTMLData
End Function

If I can't get this to work, I have an alternate solution I would like to
try. But I have encountered a problem with that one as well.

For my alternate solution I have used a button control on a tab in my
contact form to launch an XL Sheet. This would work as well, just not what I
was hoping to do for this purpose. The problem with this option is the
command code launches the pre-set XL-sheet from the D drive of my computer.
This contact form design is to be used on the public drive and I would need
the code to instruct the XL-Sheet to launch form the public drive so all who
have access can get the same information. Is this possible? If it is easier
to get working then I would go this route and forget my original design. I
have the code that launchs form the D-drive for this alternate option if it
helps? Can it be cchanged to launch an ex-sheet form the public drive?

Sub GroupINFO_Click

Set objExcelApp = Item.Application.CreateObject("Excel.Application")
objExcelApp.Workbooks.Open("GroupINFO.xls")
Set objExcelBook = objExcelApp.ActiveWorkbook
Set objExcelSheets = objExcelBook.Worksheets
Set objExcelSheet = objExcelBook.Sheets(1)
objExcelSheet.Activate
objExcelApp.Application.Visible = True

End Sub

-
IT Girl

"Sue Mosher [MVP-Outlook]" wrote:

If you look at these two statements and compare with the source code at
http://www.outlookcode.com/article.aspx?id=69, you should see your mistake:

Set XLSheet = Item.GetInspector.ModifiedFormPages("Tab2")
Set XLSheet = oPage.Controls("Spreadsheet1")

You have two statements instantiating an object variable named XLSheet, when
what you need is one statement to instantiate a variable named oPage, then a
second statement to instantiate XLSheet.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54




"IT Girl" wrote:

Hi Sue... Thanks for the help by the way.. O.k. So this is the code.

Dim XLSheet

Function Item_Open()
Set XLSheet = Item.GetInspector.ModifiedFormPages("Tab2")
Set XLSheet = oPage.Controls("Spreadsheet1")
XLSheet.HTMLData = Item.Body
Item.Subject = Trim(Item.Subject & " ") 'Dirty the form
End Function

Function Item_Write()
Item.Body("XLSheet") = XLSheet.HTMLData
End Function

I rechecked the Contral and page name just to make sure i have them right
and in the right places.


Ads