• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

merge data in excel to word

Belleke

Active Member
Something in that direction?
unzip first.
I changed your doc to a template (dotx)
See the 2 green lines in the Code (Alt + F11) in the excel file.
These
'Requires Tools > References > Microsoft Word xx.0 Object Library !!!!!!
xx.0 Object Library can be 12.0 Object Library or 16.0 Object Library... or...

'doc = "C:\Users\xxxx\xxxx\xxxx\PRP.dotx" 'Change to your Dir !!!!!!
Cheers
 

Attachments

rohit varma

New Member
the code is running but the problem is it is showing the errror as "file does not exist or renamed".i will upload a screenshoot of that errror.plz go through that and give me a solution.
 

Attachments

rohit varma

New Member
i am uploadign one more image where i have added the address location of word document in the vba code you have written
 

rohit varma

New Member
Something in that direction?
unzip first.
I changed your doc to a template (dotx)
See the 2 green lines in the Code (Alt + F11) in the excel file.
These
'Requires Tools > References > Microsoft Word xx.0 Object Library !!!!!!
xx.0 Object Library can be 12.0 Object Library or 16.0 Object Library... or...

'doc = "C:\Users\xxxx\xxxx\xxxx\PRP.dotx" 'Change to your Dir !!!!!!
Cheers
hello miss. could you please resolve this issue
 

Belleke

Active Member
For this line
Requires Tools > References > Microsoft Word xx.0 Object Library !!!!!!
Go to the VBA editor (Alt+F11) click Tools then click references and then scroll down and check the checkbox Microsoft Word xx.0 Object Library !!!!!!
xx is a version
(mine =Microsoft Word 16.0 Object Library, this depends on your excel version)
see image
For this line
doc = "C:\Users\xxxx\xxxx\xxxx\PRP.dotx" 'Change to your Dir !!!!!!
Go to the folder where my PRP word document is.(Important use my template, because of the bookmarks!!!)
Click in the box with the link next to the text, then you will see something like
C:\Users\ACER\Documents\Bookmark word (this is an example of my laptop)
Then Replace C:\Users\xxxx\xxxx\xxxx with your result of your line
C:\Users\ACER\Documents\Bookmark word
Use my PRP.dotx word template because there are bookmarks in the document.
Once you are done you can delete this line

'Requires Tools > References > Microsoft Word xx.0 Object Library !!!!!!
and in this line delete the apostrof (see the red sign in front of the line and delete the other red part at the back)

'doc = "C:\Users\xxxx\xxxx\xxxx\PRP.dotx" 'Change to your Dir !!!!!!
I hope it is clearer now.
 

Attachments

Last edited:

rohit varma

New Member
hey thank you.It's working now but you changed the format of my word document.coul u please check over that or guide me how to change that.
The format i want is as in "new documents" but u have changed that, like in prp.docx
 

Attachments

Belleke

Active Member
Go to File -> Options -> look for Show bookmarks (I can't give you more details because I am working with a Dutch office) Then you will see the bookmarks in the document, just do the same with your file.
 

rohit varma

New Member
hey while i am creating a new file "prp no" and "ie no" are creating in text format.which code has to be added to change it to number format and where to add that code
 

Attachments

Top