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 / Word / Programming / November 2006

Tip: Looking for answers? Try searching our database.

type mismatch error?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Angyl - 02 Nov 2006 17:24 GMT
I'm moving data inputted into a userForm to Form Fields in a word document
and I need to multiply some of the data by 12 (because I'm going from monthly
to yearly amounts).  This code:

.FormFields("txtAnnualGross1").Result = WCInfo.txtMonthlyGross1

Does the job just fine of getting the base, (entered as monthly gross) into
the form field, but when I try:

.FormFields("txtAnnualGross1").Result = WCInfo.txtMonthlyGross1 * 12

I get a type mismatch error.  How do I get this thing to let me multiply the
result by 12 before putting it in the form?
Jonathan West - 02 Nov 2006 18:27 GMT
> I'm moving data inputted into a userForm to Form Fields in a word document
> and I need to multiply some of the data by 12 (because I'm going from
[quoted text clipped - 12 lines]
> the
> result by 12 before putting it in the form?

Do your type conversions explicitly, like this

.FormFields("txtAnnualGross1").Result = CStr(Val(WCInfo.txtMonthlyGross1) *
12)

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org

Angyl - 02 Nov 2006 19:27 GMT
You rule...

> > I'm moving data inputted into a userForm to Form Fields in a word document
> > and I need to multiply some of the data by 12 (because I'm going from
[quoted text clipped - 17 lines]
>  .FormFields("txtAnnualGross1").Result = CStr(Val(WCInfo.txtMonthlyGross1) *
> 12)
 
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



©2008 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.