Excel cell value with space between paragraphs with excel to word bookmark

molesy01

Board Regular
Joined
Dec 23, 2012
Messages
61
Hi
I have a userform in excel that copies text from a cell and puts it within a bookmark in a word template. I have created code which works however the issue i have is that i require more than 1 cell value to populate into a single bookmark with a space between the paragraphs. Hope someone can help. Thanks

sub ExportButton(control As IRibbonControl)

Dim objWord As Object
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("Testing")
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
objWord.Activate
objWord.Documents.Open "\\Desktop\Testing.dotm"
With objWord.ActiveDocument
.Bookmarks("RPD").Range.Text = ws.Range("E10").Value
.Bookmarks("RPD").Range.Text = ws.Range("E12").Value
.Bookmarks("RPD").Range.Text = ws.Range("E14").Value

End With

Set objWord = Nothing

End Sub
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Would i need to have all of the sheets completed for it to work without the error, I only have Section A,B,C with text in column E, ?
 
Upvote 0
Shouldn't error on that line of code but it would eventually error. If the code was successful, then some documents would have been produced. Just thought of something. If the code errors, you need to go to the task manger, select Microsoft Word and End Process before re-trialing the code. Dave
 
Upvote 0
Shouldn't error on that line of code but it would eventually error. If the code was successful, then some documents would have been produced. Just thought of something. If the code errors, you need to go to the task manger, select Microsoft Word and End Process before re-trialing the code. Dave
Hi Dave yes I always delete the last doc in task manager. I will put a doc and wb together and send over to your email to see if it can be done. Thanks
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,173
Members
452,615
Latest member
bogeys2birdies

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