How to hit 'Enter' in Excel VBA that is controlling Publisher

Bacalhau75

New Member
Joined
Jul 9, 2014
Messages
12
Hi, I work in a large company and I've been asked to write a macro to 'find / replace' text within publisher docs to facilitate the process since there are 1000's of documents that require the same update. It's my first time working with Publisher and already learned that there is no 'Record' function and examples on Google are limited.
I got the macro working for the most part, but I'm stuck at a simple 'Sendkeys' function or possibly something using chr(10)/chr(13). ( i tried both together and excel locks up while chr(10) or chr(13) don't seem to do anything.

Part of the document contains an outline.
A. something something
Paragraph continues here
A little more blah blah

B. Something new here
Continues down here
And it ends here.

The code searches for "And it ends here." and i'm trying to replace it with =
"And it ends here.
C. Something new for bullet C
Continues down here
And it ends here"

I've been able to to replace the text, but it does not place the C as it's own bullet entry. It think it's part of B', so it looks like this.

B. Something new here
Continues down here
And it ends here.
C. Something new for bullet C
Continues down here
And it ends here"


i overcame the limitation of 255 characters for a variable, but can't figure out how to paste part of the replaced text, hit enter in order to create a new bullet ("C") and then paste the rest of the text.

Any help would be greatly appreciated.

Thanks,
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
i just noticed that after i posted my question the outline example, got 'flattened'. the letters A, B, C remain close to the edge, while the body of each bullet seems to be tabbed in 10 spaces or so.
 
Upvote 0

Forum statistics

Threads
1,215,731
Messages
6,126,539
Members
449,316
Latest member
sravya

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