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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retreive data from Excel to Populate word bookmarks

Status
Not open for further replies.

HARRYJAY

Programmer
Mar 11, 2006
3
US
Hi All,

I am working on a Project where I have data in a Excel worksheet (each line is a record). I need to pass that
data to Bookmarks defined in a Word Template.

According to requirements, the VBA code has to reside in Word Doc and I need to link excel worhsheet and read each row in excel worksheet and create a word documents.

I am new to VBA and I only know that you can do that by inserting Bookmarks in word template but I don't know how to read excel worksheet row by row and populate the bookmarks and create word documents for printing.

I also need to perform some calculations on few columns in excel before populating Bookmarks in Word Template.

The sample data in Excel worksheet are:
NAME |Address|Annual income|401K% |Bonus|Oncall|Overtime|

I need to add Bonus+oncall+overtime before populating TotalIncome BookMark in word template. And also calculate the % of Annual income to get 401K amount(eg 3% of annual income = 401K contribution).

I would greatly appreciate if someone could give me some coding help on this.

Thanks
harryj



 
Why not simply do a MailMerge with the Excel worksheet as data source ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PHV, I am not sure how to do MailMerge as I am from Unix background and have never done that. I would really appreciate your help if you could show me some direction to do that.
 
Simply follow the MailMerge wizard found in the Tools menu when in Word.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PHV, I am now able to use MailMerge by inserting fields on my Word template.

But what I don't know is, how to perform calculations in it? because some of the fields that I want to show on Word document are result of calculation.

For eg: I want to print Total Monthly Income on the letter, which is sum of (Regular Pay+Oncall+Overtime) and some of the fields are % of Monthly income like 401K contribution is 3% of Monthly income. So I need to perform calculation on it to get the result.

If you can guide me on it that would be tremendous help.

Thanks again,
HarryJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top