BostonVB
08-09-2011, 05:50 PM
I have a macro that someone gave me that isn’t working properly.
I have some experience in Excel and I’m not sure how to work with the fields in Word.
The piece that seems to not be working is the final line of code
ThisDocument.FormFields(149).Result = ReadmitRisk
I have tested the fields that determine the value for ReadmitRisk and when I check this in the Immediate window the calculations are working as appropriate. However, the goal is to get that value to populate in the text form field ReadmitRisk.
The following variables are being used to calculate the value for ReadmitRisk.
Admit Source = AdmitSource
Hosp. Visits Last 6 months = HospVisits
ED. Visits Last 6 months = EDVisits
Polypharmacy (≥5 routine meds)? = PolyPharm
Total # Problem Meds: = TotProblemMeds
This macro is set to run after exit of TotProblemMeds.
It also looks like there is some use of .select which I would never do in Excel. Is there a reason to do it in Word?
Test file attached.
Any help is much appreciated!
I have some experience in Excel and I’m not sure how to work with the fields in Word.
The piece that seems to not be working is the final line of code
ThisDocument.FormFields(149).Result = ReadmitRisk
I have tested the fields that determine the value for ReadmitRisk and when I check this in the Immediate window the calculations are working as appropriate. However, the goal is to get that value to populate in the text form field ReadmitRisk.
The following variables are being used to calculate the value for ReadmitRisk.
Admit Source = AdmitSource
Hosp. Visits Last 6 months = HospVisits
ED. Visits Last 6 months = EDVisits
Polypharmacy (≥5 routine meds)? = PolyPharm
Total # Problem Meds: = TotProblemMeds
This macro is set to run after exit of TotProblemMeds.
It also looks like there is some use of .select which I would never do in Excel. Is there a reason to do it in Word?
Test file attached.
Any help is much appreciated!