Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Forms / April 2006

Tip: Looking for answers? Try searching our database.

Problem Printing Customized Outlook Form using Word Template

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ajkim001 - 24 Jan 2006 22:17 GMT
I created an OL form and used the Sub cmdPrint_Click code to print the form
data.  I got the oDoc.FormFields ("FieldName").Result = item.userproperties
("FieldName") part working.  However, I'm having trouble with the checkboxes
and radio buttons.  I've tried using oDoc.FormFields("FieldName").CheckBox =
item.userproperties("FieldName") but it doesn't work.  Maybe I'm missing
something or is there a different code that I need to use to transfer the
data to the Word template?

I hope someone has the answer to this.  I've searched online and in Word and
Outlook books to no avail.  Thank you!
Sue Mosher [MVP-Outlook] - 24 Jan 2006 23:01 GMT
You should to set the check box's Value property explictly, and the expression you set it to must be a True/False expression:

oDoc.FormFields("FieldName").CheckBox.Value = item.userproperties("FieldName")
Signature

Sue Mosher, Outlook MVP
  Author of Configuring Microsoft Outlook 2003
    http://www.turtleflock.com/olconfig/index.htm
  and Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

>I created an OL form and used the Sub cmdPrint_Click code to print the form
> data.  I got the oDoc.FormFields ("FieldName").Result = item.userproperties
[quoted text clipped - 6 lines]
> I hope someone has the answer to this.  I've searched online and in Word and
> Outlook books to no avail.  Thank you!
ajkim001 - 24 Jan 2006 23:37 GMT
Thank you so much Sue.  I will try using the value property.
And how would this work with a radio button?  Would it be the same code but
"OptionButton" in place of "CheckBox"?

> You should to set the check box's Value property explictly, and the expression you set it to must be a True/False expression:
>
[quoted text clipped - 9 lines]
> > I hope someone has the answer to this.  I've searched online and in Word and
> > Outlook books to no avail.  Thank you!
Sue Mosher [MVP-Outlook] - 25 Jan 2006 14:04 GMT
Sorry, but I've never seen an option button control in a Word document. How did you do that?

Signature

Sue Mosher, Outlook MVP
  Author of Configuring Microsoft Outlook 2003
    http://www.turtleflock.com/olconfig/index.htm
  and Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> Thank you so much Sue.  I will try using the value property.
> And how would this work with a radio button?  Would it be the same code but
[quoted text clipped - 3 lines]
>>
>> oDoc.FormFields("FieldName").CheckBox.Value = item.userproperties("FieldName")

>> >I created an OL form and used the Sub cmdPrint_Click code to print the form
>> > data.  I got the oDoc.FormFields ("FieldName").Result = item.userproperties
[quoted text clipped - 6 lines]
>> > I hope someone has the answer to this.  I've searched online and in Word and
>> > Outlook books to no avail.  Thank you!
ajkim001 - 25 Jan 2006 16:20 GMT
I've never done it before either.  I was wondering if it was even possible.  
I guess I'll just have to change the Outlook form to use checkboxes instead
of radio buttons.

I apologize but I have another question.  Now that I've got the script to
work, I'm having a problem with the oDoc.FormFields' appearing in the
printouts.
To better explain, I have written the code and what appears on the printed
form.
Code:
oDoc.FormFields("NewspaperOrMagazine").Result =
item.userproperties("Newspaper or Magazine")
Printed form:
[ ]  Newspaper/Magazine:  <<NewspaperOrMagazine>>

It doesn't show this in all the fields, just a few.  I can't seem to figure
it out.

> Sorry, but I've never seen an option button control in a Word document. How did you do that?
>
[quoted text clipped - 16 lines]
> >> > I hope someone has the answer to this.  I've searched online and in Word and
> >> > Outlook books to no avail.  Thank you!
Sue Mosher [MVP-Outlook] - 25 Jan 2006 16:32 GMT
Why change the Outlook form? It's Word that doesn't have option buttons fields. You can decide how you want to show the property value in the Word document -- either with checkbox fields or text fields.

Sorry, but I don't understand what the "this" in "show this" is.

Signature

Sue Mosher, Outlook MVP
  Author of Configuring Microsoft Outlook 2003
    http://www.turtleflock.com/olconfig/index.htm
  and Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> I've never done it before either.  I was wondering if it was even possible.  
> I guess I'll just have to change the Outlook form to use checkboxes instead
[quoted text clipped - 15 lines]
>
>> Sorry, but I've never seen an option button control in a Word document. How did you do that?

>> > Thank you so much Sue.  I will try using the value property.
>> > And how would this work with a radio button?  Would it be the same code but
[quoted text clipped - 14 lines]
>> >> > I hope someone has the answer to this.  I've searched online and in Word and
>> >> > Outlook books to no avail.  Thank you!
ajkim001 - 26 Jan 2006 17:09 GMT
ahhh I see what you mean :o)
How can I show the value of the option button in the Outlook form to appear
as a text field in the Word doc?

I apologize for not being able to better explain what it is that I am
seeing.  Perhaps I will post my question again when I come up with a better
description of the problem.

> Why change the Outlook form? It's Word that doesn't have option buttons fields. You can decide how you want to show the property value in the Word document -- either with checkbox fields or text fields.
>
[quoted text clipped - 38 lines]
> >> >> > I hope someone has the answer to this.  I've searched online and in Word and
> >> >> > Outlook books to no avail.  Thank you!
Sue Mosher [MVP-Outlook] - 26 Jan 2006 19:42 GMT
The details are going to depend on the nature of the option button(s). Is it a set of buttons bound to one Outlook property? (What kind of property?) Then you may be able to handle just like a text field.

Signature

Sue Mosher, Outlook MVP
  Author of Configuring Microsoft Outlook 2003
    http://www.turtleflock.com/olconfig/index.htm
  and Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> How can I show the value of the option button in the Outlook form to appear
> as a text field in the Word doc?
ajkim001 - 24 Jan 2006 23:56 GMT
FYI~ I used the code and it works perfectly... :o)

> You should to set the check box's Value property explictly, and the expression you set it to must be a True/False expression:
>
[quoted text clipped - 9 lines]
> > I hope someone has the answer to this.  I've searched online and in Word and
> > Outlook books to no avail.  Thank you!
Martin - 31 Jan 2006 10:40 GMT
In case it's helpful to anyone, this is what I used to deal with the problem
(in can be adapted for either option buttons or checkboxes):

For counter = 1 to intBkList
 strField = Trim(objWord.ActiveDocument.Bookmarks(counter))
 Set objPage =Item.GetInspector.ModifiedFormPages("Message")
 Set objControl = objPage.Controls(strField)
 strField1 = objControl.Value
 If strField1 = True then
   strField2 = "¤"
 ElseIf strField1 = False then
   strField2 = "¡"
 Else
   strField2 = strField1
 End If       
 objWord.ActiveDocument.Bookmarks(strField).Range.Text = Cstr(strField2)
Next

Forget option buttons/check boxes in Word: it's only being used for the
printout so make sure the correct areas of your template are formatted to
Wingdings and use this code to drop in the right symbol!

> FYI~ I used the code and it works perfectly... :o)
>
[quoted text clipped - 11 lines]
> > > I hope someone has the answer to this.  I've searched online and in Word and
> > > Outlook books to no avail.  Thank you!
A Don - 26 Jan 2006 13:41 GMT
Sorry I've posted this in the wrong group...still any replies are welcome!

> I created an OL form and used the Sub cmdPrint_Click code to print the form
> data.  I got the oDoc.FormFields ("FieldName").Result = item.userproperties
[quoted text clipped - 6 lines]
> I hope someone has the answer to this.  I've searched online and in Word and
> Outlook books to no avail.  Thank you!
Daniel Reyes - 27 Apr 2006 14:11 GMT
I tried using that code but I get the following error - "MS Word: The
requested member of the collection does not exist.".

Daniel

-=-=-=-=-=-=-=

> I created an OL form and used the Sub cmdPrint_Click code to print the form
> data.  I got the oDoc.FormFields ("FieldName").Result = item.userproperties
[quoted text clipped - 6 lines]
> I hope someone has the answer to this.  I've searched online and in Word and
> Outlook books to no avail.  Thank you!
Martin - 27 Apr 2006 16:07 GMT
Hi Daniel

I'm assuming you're answering my message (but I may be wrong):

For counter = 1 to intBkList
 strField = Trim(objWord.ActiveDocument.Bookmarks(counter))
...
 objWord.ActiveDocument.Bookmarks(strField).Range.Text = Cstr(strField2)
...

If you're getting the Word error message it must be to do with one of the
lines I've reproduced above.  It could mean Word isn't finding the particular
bookmark so I guess your "counter" variable has reached a number for which
there's no equivalent index for a bookmark in the active document.  Have you
set intBkList too high?

> I tried using that code but I get the following error - "MS Word: The
> requested member of the collection does not exist.".
[quoted text clipped - 13 lines]
> > I hope someone has the answer to this.  I've searched online and in Word and
> > Outlook books to no avail.  Thank you!
Hollis Paul [MVP - Outlook] - 28 Apr 2006 03:40 GMT
> I tried using that code but I get the following error - "MS Word: The
> requested member of the collection does not exist.".

Take a look at this thread at www.outlookcode.com:

http://www.outlookcode.com/threads.aspx?forumid=3&messageid=16377
How to get at the values of user defined fields on a custom form?

Note Sue's comment: Sue Mosher   10-Feb-2006  06:48    
Because UserProperties is for custom fields, not built-in fields. If you
have Outlook 2003, you can use ItemProperties for both.

Sue also has a page about the syntax for using fields in scripts, but I
can't find it today.  You should try again later.

--
Hollis Paul
Mukilteo, WA  USA
Sue Mosher [MVP-Outlook] - 28 Apr 2006 09:26 GMT
That page is at http://www.outlookcode.com/d/propsyntax.htm 

Signature

Sue Mosher, Outlook MVP
  Author of Configuring Microsoft Outlook 2003
    http://www.turtleflock.com/olconfig/index.htm
  and Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx
 

>> I tried using that code but I get the following error - "MS Word: The
>> requested member of the collection does not exist.".
[quoted text clipped - 14 lines]
> Hollis Paul
> Mukilteo, WA  USA
Hollis Paul [MVP - Outlook] - 28 Apr 2006 16:36 GMT
> That page is at http://www.outlookcode.com/d/propsyntax.htm

Thank you, Sue.  I searched on syntax and it never came up.  I will go
read it and find a good keyword to use.

--
Hollis Paul
Mukilteo, WA  USA
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.