Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inserting a fields from one record into Word
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00449272
Message ID:
00450001
Views:
46
Like I said before, I hadn't tried this code in Word, and was certain it would take some cobbling to fix; I'm relating this from memory and in quite a time crunch. I hadn't expected this thread to continue so long <s>.

Rick picked up on the first problem; you should be calling Word.Application instead of Word.Document. While Word.Document works, it's easier to keep things straight in your code if you start with the Application object and work downwards. There are a number of things that relate directly to the Application object as well as the Document object -- you definitely need to access both objects when automating Word.

The next situation is this one:

>oRange = oDocument.selection.range()

The reference should be to oWord, not oDocument. I had mistakenly remembered that there is one "current cursor location" (Selection object) for each Document, and a quick trip back to the book showed me where my memory failed (eventually I'll remember to RTFM <G>). There is one Selection object for the whole Application.

The remaining methods/properties are going to reference the proper objects; any problems with those lines can easily be rectified by looking in Word's VBA Help file for the proper order and type of parameters.

- della
Previous
Reply
Map
View

Click here to load this message in the networking platform