mattymatt79
IS-IT--Management
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
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