Word Report using excel database

samfolds

Board Regular
Joined
Jul 2, 2009
Messages
191
Hello all,

I'm looking for a way to save/print several reports by changing only certain information in that report. Those information are placed in an excel database and all I want to do is somehow create a word template and link each column to a certain place. For example, say my excel database had the columns :

NamesAddressPhoneSam1234 pool st.123-456-7891Jack4321 sack st.323-525-9874Gil654 8th avenue325-525-8787Andrew987 9th st.322-252-5252

And my reports looks like this :

*****************************************
Hello "NAME",

blablablabla "PHONE" blablablabla.

blablablablablabla "ADDRESS".
*****************************************


I would like to loop through all the rows (1 report per row) and save the report in the form : Report-2010-"NAME".doc ...

Can someone enlight me on how to do that?

Thank you very much.

Samfolds
 
You are right, I did forget to put it in the control sheet (Just corrected it). Furthermore, I totally agree that it is better to put lots of data in the control sheet as it's much easier to change something if I or others need to.

Thank you, hope this is going to help others in the future as well -_-

Samfolds
 
Upvote 0

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Ok nevermind about all that I had to browse in the Office folder to add the MSWORD.OBL file. The Microsoft Word Object 11.0 Library then appeared. Will try and run it and get back to you shrotly.

Thanks

Samfolds
Hi Derek / Samford,

I am getting same VBA compile error
Dim oApp As Word.ApplicationCan you please explain in detail what exactly I need to do to overcome this error?

Thanks and Warm Regards,
Prasad
 
Upvote 0
From #5:
Here is the code - press Alt +F11 and create a new code module and enter the following code:
You will need to use Tools | Reference to add a reference to the Microsoft Word Object 11.0 Library (it would be 12.0 for Office 2007).
Did you set the reference to Word as per the above? As you will see, the version number (e.g. 11.0, 12.0) depends on the version of Office installed.
 
Upvote 0
Hi Derek,

I am using office 2007 and Microsoft Word Object 12.0 Library is already checked in Tools|Reference. Please advise.

Thanks for your prompt reply.
 
Upvote 0
Hi Derek,

I am using office 2007 and Microsoft Word Object 12.0 Library is already checked in Tools|Reference. Please advise.

Thanks for your prompt reply.
oops!!! I cought my mistake.....I was looking at Microsoft Office Object 12.0 and not the Word. I really appologize for this Derek. The reason may be I am very new to VBA.

but now I am getting the second error further
Run-Time error 430
Class does not support Automation or does not support expected interface.

Can you please help on this error?
 
Upvote 0
oops!!! I cought my mistake.....I was looking at Microsoft Office Object 12.0 and not the Word. I really appologize for this Derek. The reason may be I am very new to VBA.

but now I am getting the second error further
Run-Time error 430
Class does not support Automation or does not support expected interface.

Can you please help on this error?
The error is on the below line:
'Set oApp = CreateObject("Word Application")
Set oApp = New Word.Application
 
Upvote 0
Now I am getting different error on same line:
Run time error'13'
type mismatch
Hi Derek,

I tried once more with the procedure.
When I use: Set oApp = New Word.Application I am getting below error
Run-Time Error 430
Class does not support Automation or does not support expected interface

When I use: Set oApp = CreateObject("Word Application") I am getting below error
Run-Time Error 429
ActiveX componant can't create object

Your help would be much appriciated in this situation.

Thank you for your time.
 
Upvote 0

Forum statistics

Threads
1,214,551
Messages
6,120,156
Members
448,948
Latest member
spamiki

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top