Article ID: 171158
Article Last Modified on 2/12/2007
Public Sub OlGridExample()
'*********************************************************************
' In this example the Grid control is on tab P.2 of the form.
' The form is open, and is not in design mode.
'*********************************************************************
Set objOutlook = Nothing
Set objOutlook = CreateObject("Outlook.Application")
Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set objInspector = objOutlook.ActiveInspector
Set objItem = objInspector.CurrentItem
'*********************************************************************
' Reference the Grid control on the modified Form.
'*********************************************************************
Set Controls = objItem.GetInspector.ModifiedFormPages("P.2").Controls
Set ctrlGrid = Controls("Grid1")
'*********************************************************************
' Populate the Grid control with data.
'*********************************************************************
ctrlGrid.Col = 1
ctrlGrid.Row = 0
ctrlGrid.Text = "Test"
ctrlGrid.Col = 1
ctrlGrid.Row = 1
ctrlGrid.Text = Int((6 * Rnd) + 1) ' Generate random value
' between 1 and 6.
'*********************************************************************
' Retrieve and display the Grid control data in a message box.
'*********************************************************************
ctrlGrid.Col = 1
ctrlGrid.Row = 0
dataString1 = ctrlGrid.Text
ctrlGrid.Col = 1
ctrlGrid.Row = 1
dataString2 = ctrlGrid.Text
MsgBox "The value set for " & dataString1 & " is " & dataString2
End Sub
Additional query words: OutSol OutSol97
Keywords: kbcode kbhowto kbprogramming KB171158