Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy Header information
Message
From
09/10/2011 22:59:02
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
09/10/2011 13:12:33
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Miscellaneous
Thread ID:
01525836
Message ID:
01525936
Views:
42
I don't know for sure - I haven't done much Word Automation (I did more Excel). But it looks as if the text you just inserted is automatically selected. In that case, you have to press, for example, "right-arrow" (or in this case, issue the corresponding Automation command), to have the cursor go after the inserted text.

>Hilmar:
>
>Thanks, but I'm not there yet. So far, I have the following code that does not work:
>
>
>#DEFINE wdPageBreak 7
>#DEFINE wdCollapseEnd 0
>
>loWord = CREATEOBJECT('word.application')
>
>loWord.Visible = .t.   &&for debugging
>
>loWord.Documents.ADD()
>
>loWord.ActiveDocument.RANGE.InsertFile('c:\testa\doc a.doc')  &&doc a is there and the cursor is at the begginning of the inserted text
>loWord.ActiveDocument.RANGE.Collapse(wdCollapseEnd)   &&this doesn't seem to do anything
>loWord.ActiveDocument.RANGE.InsertBreak(wdPageBreak)  &&Now I have 2 pages, but the inserted text disappears!!!
>
>
>In fact, whatever I do, the file that I just inserted, gets overwritten by whatever I insert next. How can I make sure that whatever I insert get inserted AFTER the text?
>
>
>>Within Word (without Automation), to get different headers, you would have to start a new section instead of a new page (insert section command), un-link the section from the previous one (so that it can have an independent header), and change the header. I don't know how to do this with Automation, but perhaps if you save macros in Word you can then look at the generated code and adapt it.
>>
>>>Hi All:
>>>
>>>I want to write a macro, eventually translatig it into VFP code, to combine a number of Word files into 1 file for either viewing or printing.
>>>
>>>I plan to do this:
>>>
>>>
>>>open a blank 'master' file in word
>>>
>>>for as many files as there are in the folder do this:
>>>    open up file n
>>>    select the entire file
>>>    copy
>>>    close the file
>>>    paste into the master file
>>>    simulate a control->enter to get a new page
>>>end for
>>>
>>>
>>>The problem is that when I've tested doing this by hand, all the pages in the master file get the header of the first file I pasted. I want the header to change every time I paste to the header of the file I copied from.
>>>
>>>How do I do this?
>>>
>>>Thanks,
>>>
>>>Yossi
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform