Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook Custom Form VBA Question

Status
Not open for further replies.

mattymatt79

IS-IT--Management
Nov 15, 2005
10
US
Ok,
I read through the office kb article about adding in

' If the form contains user-defined fields, you can use
' the following syntax to transfer the contents of a
' user-defined field (FieldName) to Word:
' strMyField = Item.UserProperties.Find("FieldName")
' oDoc.FormFields("Text3").Result = strMyField

to make a form print into word.

I created the template in word like it told me too, and I added the form objects inside my form, however; when I try and run it I get an error saying strMyField isnt legal.

My code looks like this

strMyField = Item.UserProperties.Find("DealerName")
oDoc.FormFields("Text1").Result = strMyField

strMyField = Item.UserProperties.Find("CustomerName")
oDoc.FormFields("Text2").Result = strMyField

strMyField = Item.UserProperties.Find("CustomerAddress")
oDoc.FormFields("Text3").Result = strMyField

strMyField = Item.UserProperties.Find("City")
oDoc.FormFields("Text4").Result = strMyField

strMyField = Item.UserProperties.Find("Zip")
oDoc.FormFields("Text5").Result = strMyField

strMyField = Item.UserProperties.Find("CustomerPhone")
oDoc.FormFields("Text6").Result = strMyField

strMyField = Item.UserProperties.Find("WhatPrompted")
oDoc.FormFields("Text7").Result = strMyField

strMyField = Item.UserProperties.Find("WhatNews")
oDoc.FormFields("Text8").Result = strMyField

strMyField = Item.UserProperties.Find("WhatRadio")
oDoc.FormFields("Text9").Result = strMyField


but what am I doing wrong? I thought by defining strMyField = Item.UserProperties.Find would define it there and allow me to move to Word?

Anyone able to help a guy who doesn't really have a clue as to whats going on?
Thanks,

Matt
 
Ok, Ive figured out its something inside the strMyField

Any clue?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top