ChuckRush
asked on
Outlook Form with VB Script
Experts
I have an Outlook for the has several Combo Boxes. After the selections are made i want to create a template message and send it. I have the following code and i am getting and error telling me the the object does not support the property in line 10 (Item ....) of the following code. I am sure it is syntax but i can't seem to find an example to fit my situation.
Function Item_Send
dim objItem, ctl, wStr
'Create BODY Text
set objItem=Item.GetInspector. ModifiedPa ges("HelpD eskTicket" ).Controls ("Body")
objItem.Body = "@title=" & Item.UserProperties.Find(" txtTitle") .value & vbCrLf & _
"@custom_2=" & Item.UserProperties.Find(" txtProblem Descriptio n").value & vbCrLf & _
"@category=" & Item.UserProperties.Find(" cmbCategor y").value & vbCrLf & _
"@impact=" & Item.UserProperties.Find(" cmbImpact" ).value & vbCrLf & _
"@priority=" & Item.UserProperties.Find(" cmbPriorit y").value & vbCrLf & _
"@custom_1=" & Item.UserProperties.Find(" cmbLocatio n").value & vbCrLf & _
"@custom_3=" & Item.UserProperties.Find(" txtPhoneNu mber").val ue & vbCrLf
end Function
Thanks
I have an Outlook for the has several Combo Boxes. After the selections are made i want to create a template message and send it. I have the following code and i am getting and error telling me the the object does not support the property in line 10 (Item ....) of the following code. I am sure it is syntax but i can't seem to find an example to fit my situation.
Function Item_Send
dim objItem, ctl, wStr
'Create BODY Text
set objItem=Item.GetInspector.
objItem.Body = "@title=" & Item.UserProperties.Find("
"@custom_2=" & Item.UserProperties.Find("
"@category=" & Item.UserProperties.Find("
"@impact=" & Item.UserProperties.Find("
"@priority=" & Item.UserProperties.Find("
"@custom_1=" & Item.UserProperties.Find("
"@custom_3=" & Item.UserProperties.Find("
end Function
Thanks
ASKER
Chris i am still getting a 'does not support this property' on the line
set objItem=Item.GetInspector. ModifiedPa ges("HelpD eskTicket" ).Controls ("Body")
set objItem=Item.GetInspector.
LIke I said i'm not competent ;o)
But in that case try:
set objItem=Item.GetInspector. ModifiedPa ges("HelpD eskTicket" )
objItem.Body = ...
Chris
But in that case try:
set objItem=Item.GetInspector.
objItem.Body = ...
Chris
Note I am assuming that item is in scope ... if not then it is likely that item is the issue ... can you provide more info on the overall structure of the code sequencing if so?
for example may lead to replacing item with:
Current item selected in the folder of outlook
application.ActiveExplorer .Selection (1)
or
Current inspector, (open item) in outlook app
application.ActiveInspecto r.currentI tem
Chris
for example may lead to replacing item with:
Current item selected in the folder of outlook
application.ActiveExplorer
or
Current inspector, (open item) in outlook app
application.ActiveInspecto
Chris
ASKER
Chris
I have attached the entire code stream. The form is an Outlook form based on a Message. It has 2 text boxes and 4 combo boxes.
Still getting an error on set objItem=GetInspector.Modif iedPages(" HelpDeskTi cket").Ite m("Body")
I have attached the entire code stream. The form is an Outlook form based on a Message. It has 2 text boxes and 4 combo boxes.
Still getting an error on set objItem=GetInspector.Modif
Option Explicit
Function Item_Open
ReadCategoryText()
ReadImpactText()
ReadPriorityText()
ReadLocationText()
End Function
Function Item_Send
dim objItem, ctl, wStr
'Create BODY Text
set objItem=GetInspector.ModifiedPages("HelpDeskTicket").Item("Body")
objItem.Body = "@title=" & Item.UserProperties.Find("txtTitle").value & vbCrLf & _
"@custom_2=" & Item.UserProperties.Find("txtProblemDescription").value & vbCrLf & _
"@category=" & Item.UserProperties.Find("cmbCategory").value & vbCrLf & _
"@impact=" & Item.UserProperties.Find("cmbImpact").value & vbCrLf & _
"@priority=" & Item.UserProperties.Find("cmbPriority").value & vbCrLf & _
"@custom_1=" & Item.UserProperties.Find("cmbLocation").value & vbCrLf & _
"@custom_3=" & Item.UserProperties.Find("txtPhoneNumber").value & vbCrLf
end Function
Sub ReadCategoryText()
Const ForReading = 1
Dim objFSO, objFile, wStr, ctl
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Get Text Export from MySql FOr Category
Set objFile = objFSO.OpenTextFile("c:\KACEData\Category.csv", ForReading)
'Read Each Record
'Get Field Info
set ctl=Item.GetInspector.ModifiedFormPages("HelpDeskTicket").Controls("cmbCategory")
Do While Not objFile.AtEndOfStream
wStr = objFile.ReadLine
'Get Rid of "
wStr =Mid(wstr,2)
wStr = Mid(wStr,1,len(wStr)-1)
ctl.AddItem(wStr)
Loop
objFile.Close
Set objFile = Nothing
Set objFSO = Nothing
End Sub
Sub ReadImpactText()
Const ForReading = 1
Dim objFSO, objFile, wStr, ctl
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Get Text Export from MySql FOr Impact
Set objFile = objFSO.OpenTextFile("c:\KACEData\Impact.csv", ForReading)
'Read Each Record
'Get Field Info
set ctl=Item.GetInspector.ModifiedFormPages("HelpDeskTicket").Controls("cmbImpact")
Do While Not objFile.AtEndOfStream
wStr = objFile.ReadLine
'Get Rid of "
wStr =Mid(wstr,2)
wStr = Mid(wStr,1,len(wStr)-1)
ctl.AddItem(wStr)
Loop
objFile.Close
Set objFile = Nothing
Set objFSO = Nothing
End Sub
Sub ReadPriorityText()
Const ForReading = 1
Dim objFSO, objFile, wStr, ctl
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Get Text Export from MySql FOr Priority
Set objFile = objFSO.OpenTextFile("c:\KACEData\Priority.csv", ForReading)
'Read Each Record
'Get Field Info
set ctl=Item.GetInspector.ModifiedFormPages("HelpDeskTicket").Controls("cmbPriority")
Do While Not objFile.AtEndOfStream
wStr = objFile.ReadLine
'Get Rid of "
wStr =Mid(wstr,2)
wStr = Mid(wStr,1,len(wStr)-1)
ctl.AddItem(wStr)
Loop
objFile.Close
Set objFile = Nothing
Set objFSO = Nothing
End Sub
Sub ReadLocationText()
Const ForReading = 1
Dim objFSO, objFile, wStr, ctl
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Get Text Export from MySql FOr Location
Set objFile = objFSO.OpenTextFile("c:\KACEData\Location.csv", ForReading)
'Read Each Record
'Get Field Info
set ctl=Item.GetInspector.ModifiedFormPages("HelpDeskTicket").Controls("cmbLocation")
Do While Not objFile.AtEndOfStream
wStr = objFile.ReadLine
'Get Rid of "
wStr =Mid(wstr,2)
wStr = Mid(wStr,1,len(wStr)-1)
ctl.AddItem(wStr)
Loop
objFile.Close
Set objFile = Nothing
Set objFSO = Nothing
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Chris
This code now works. I am still not comfortable that i completely understand but i am getting there.
Thanks
This code now works. I am still not comfortable that i completely understand but i am getting there.
Thanks
Option Explicit
Function Item_Open
ReadCategoryText()
ReadImpactText()
ReadPriorityText()
ReadLocationText()
End Function
Function Item_Send
dim objItem, ctl, wStr
'Create BODY Text
set objItem =Application.ActiveInspector.CurrentItem
objItem.Body = "@title=" & Item.GetInspector.ModifiedFormPages("HelpDeskTicket").Controls("txtTitle").Value & vbCrLf & _
"@custom_2=" & Item.GetInspector.ModifiedFormPages("HelpDeskTicket").Controls("txtProblemDescription").Value & vbCrLf & _
"@category=" & Item.GetInspector.ModifiedFormPages("HelpDeskTicket").Controls("cmbCategory").Value & vbCrLf & _
"@impact=" & Item.GetInspector.ModifiedFormPages("HelpDeskTicket").Controls("cmbImpact").Value & vbCrLf & _
"@priority=" & Item.GetInspector.ModifiedFormPages("HelpDeskTicket").Controls("cmbPriority").Value & vbCrLf & _
"@custom_1=" & Item.GetInspector.ModifiedFormPages("HelpDeskTicket").Controls("cmbLocation").Value & vbCrLf & _
"@custom_3=" & Item.GetInspector.ModifiedFormPages("HelpDeskTicket").Controls("txtPhoneNumber").Value & vbCrLf
end Function
Sub ReadCategoryText()
Const ForReading = 1
Dim objFSO, objFile, wStr, ctl
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Get Text Export from MySql FOr Category
Set objFile = objFSO.OpenTextFile("c:\KACEData\Category.csv", ForReading)
'Read Each Record
'Get Field Info
set ctl=Item.GetInspector.ModifiedFormPages("HelpDeskTicket").Controls("cmbCategory")
Do While Not objFile.AtEndOfStream
wStr = objFile.ReadLine
'Get Rid of "
wStr =Mid(wstr,2)
wStr = Mid(wStr,1,len(wStr)-1)
ctl.AddItem(wStr)
Loop
objFile.Close
Set objFile = Nothing
Set objFSO = Nothing
End Sub
Sub ReadImpactText()
Const ForReading = 1
Dim objFSO, objFile, wStr, ctl
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Get Text Export from MySql FOr Impact
Set objFile = objFSO.OpenTextFile("c:\KACEData\Impact.csv", ForReading)
'Read Each Record
'Get Field Info
set ctl=Item.GetInspector.ModifiedFormPages("HelpDeskTicket").Controls("cmbImpact")
Do While Not objFile.AtEndOfStream
wStr = objFile.ReadLine
'Get Rid of "
wStr =Mid(wstr,2)
wStr = Mid(wStr,1,len(wStr)-1)
ctl.AddItem(wStr)
Loop
objFile.Close
Set objFile = Nothing
Set objFSO = Nothing
End Sub
Sub ReadPriorityText()
Const ForReading = 1
Dim objFSO, objFile, wStr, ctl
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Get Text Export from MySql FOr Priority
Set objFile = objFSO.OpenTextFile("c:\KACEData\Priority.csv", ForReading)
'Read Each Record
'Get Field Info
set ctl=Item.GetInspector.ModifiedFormPages("HelpDeskTicket").Controls("cmbPriority")
Do While Not objFile.AtEndOfStream
wStr = objFile.ReadLine
'Get Rid of "
wStr =Mid(wstr,2)
wStr = Mid(wStr,1,len(wStr)-1)
ctl.AddItem(wStr)
Loop
objFile.Close
Set objFile = Nothing
Set objFSO = Nothing
End Sub
Sub ReadLocationText()
Const ForReading = 1
Dim objFSO, objFile, wStr, ctl
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Get Text Export from MySql FOr Location
Set objFile = objFSO.OpenTextFile("c:\KACEData\Location.csv", ForReading)
'Read Each Record
'Get Field Info
set ctl=Item.GetInspector.ModifiedFormPages("HelpDeskTicket").Controls("cmbLocation")
Do While Not objFile.AtEndOfStream
wStr = objFile.ReadLine
'Get Rid of "
wStr =Mid(wstr,2)
wStr = Mid(wStr,1,len(wStr)-1)
ctl.AddItem(wStr)
Loop
objFile.Close
Set objFile = Nothing
Set objFSO = Nothing
End Sub
ASKER
Thanks again Chris.
objItem = ...
Chris
Open in new window