• 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

rohit varma

New Member
i am facing a problem in merging the data written in yellow boxes in excel sheet to the word document as per fields.
 

Attachments

  • PRP.xlsm
    27.6 KB · Views: 10
  • prp.docx.docx
    13.4 KB · Views: 8
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

  • Bookmark word.zip
    47 KB · Views: 13
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

  • 1.png
    1.png
    155.9 KB · Views: 4
  • 2.png
    2.png
    117.2 KB · Views: 6
i am uploadign one more image where i have added the address location of word document in the vba code you have written
 
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
 
it is showing another error now as i mentioned in file uploaded.iam uploading
sceenshoot of that error
 

Attachments

  • 1.png
    1.png
    101.8 KB · Views: 5
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

  • Check.png
    Check.png
    58 KB · Views: 20
Last edited:
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

  • New documents.docx
    13.4 KB · Views: 7
  • prp.docx
    13.4 KB · Views: 2
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.
 
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

  • 1.png
    1.png
    129.7 KB · Views: 8
Back
Top