Hi Everyone
How do you move the insertion point in Word using VBA (from Excel)?
I want to progressively move the insertion point lower down in the Word doc to add more content.
My scenario is:
I'm running a VBA macro from within Excel VBA
In Excel create a Word doc - can do
At the top of the Word document add a text heading - can't do
Copy and paste an Excel range into Word - can do (it goes in as a Table)
Create a couple of lines of space after this Table- can't do
Add another text heading - can't do
Copy and paste a second Excel range into Word - can do
etc.
...but don't get the desired effect
Can any one give me a lead please.
WTIA
barry
Last edited by barryleajo; 12-05-2010 at 05:50 AM.
OK - No replies so not sure if my request was difficult, trivial or confusing?
In the spirit of maybe helping others I have moved this on and got something working now.
My scenario is:
ActiveDocument.Paragraph(1).Range and set the .Text propertyI'm running a VBA macro from within Excel VBA
In Excel create a Word doc - can do
At the top of the Word document add a text heading - can't do
Go to the end of the .Paragraph.Range (see below) and use .Range.InsertParagraphAfterCopy and paste an Excel range into Word - can do (it goes in as a Table)
Create a couple of lines of space after this Table- can't do
Note that you may need to keep track of paragraphs for later navigation
As above with the appropriate .ParagraphAdd another text heading - can't do
Setting a Range 'selects' it; to 'deselect' and go to the end/beginning of the Range use the Collapse method.Copy and paste a second Excel range into Word - can do
Use with care as may not be entirely accurate as I am just learning this but this info would have moved me on at the time.
Any moderators out there - please now mark as SOLVED please - thanks
barry
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks