Pasted Text Not Recognized When Creating A Word Document With VBA

longtallsunny

New Member
Joined
Mar 10, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
I have created a spreadsheet where each column matches a [variable] in a Word document. Using VBA, I replace the [variable] in the Word document with the contents of the cell in the active row. It works beautifully EXCEPT when I copy a string of text from another document (pdf or doc). To be specific, my worksheet has several variables, two of which are [shorttitle] and [longtitle]. My Word document says "Protocol: {shorttitle]: [longtitle]" When I enter data into my Excel worksheet, I usually copy and paste from another document. When I run my macro, my Word document will say "Protocol: SHORT TITLE I ENTERED: " So there is nothing for [longtitle]. HOWEVER, if I key in the long title myself, it will show up. Furthermore, if I copy the long title from a different cell in Excel it will show up. The cell format is General, which is what every other cell is. To muddy it even further, I copy and paste the [shorttitle] from another document and have no issues. Does this make sense? Anyone have a clue how to fix this?
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
****edit to above: my Word document says "Protocol: [shorttitle]: [longtitle]" I used the wrong bracket....****
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,844
Members
449,051
Latest member
excelquestion515

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