I'm having trouble finding information on how to control Microsoft Word with CorelDraw macros. I'm trying to create a Macro that can copy text from CorelDraw into Word. Ideally it will paste this text into text boxes while retaining as much formatting as possible.
I'm using X4. The initial part of the script I've written finds text objects in Draw that contain a certain word. All the text within these text objects needs to be copied. The formatting (bold, italics, size, leading) may vary throughout the text range. Retaining the formatting may be complicated but if someone knows a way to copy the text into Word text boxes it will be a good start.
Thanks for any help.
Right now I can get the following code to work from CorelDraw:Sub WordPlay()Dim i As IntegerSet wrdApp = CreateObject("Word.Application")wrdApp.Visible = TrueSet wrdDoc = wrdApp.Documents.Add ' create a new documentWith wrdDocDim Box As ShapeFor i = 1 To 2.Content.InsertAfter "Here is a example test line #" & i.Content.InsertParagraphAfterNext iEnd WithEnd SubDoes anyone know how I can get the sample text into text boxes? Thanks in advance.
I'll take a stab at it. What you'll want to do before hitting your macro would be to copy what text you want into the word text box. Now at the end of your code maybe add
SendKeys "^(v)"
this will only work if your macro opens an instance of word and your cursor ends up where it needs to be before it pastes. Otherwise you may have to add some SendKey options like "{TAB}" etc.
I don't have word so I can't see where the cursor ends up.
Myron