Working with MS Word
-
First off, I would like to thank you for taking the time to see this problem. I'm sort of a n00b when it comes to using COM objects, and unfortunately the way I'm learning has a really steep learning curve. Basically, I am trying to create a program that writes to Word, and I'm having a bit of a problem passing objects to the COM objects that I instantiate - specifically the Range and Section objects. So let me order my questions: 1) How do I correctly create a new Range object so I can add it to a Section object? 2) How do I add the Range object to the Section? (According to the VBA documentation, the Sections collection object has an Add method that takes a Range object as its first argument [MFC specifies it as a VARIANT parameter type] and placement as a second argument). Basically this is the way I see it, but I don't know how to do it: 1) Create new Range object. 2) Set information in Range object. 3) Add new Section using Sections.Add(new_range_obj, placement) If anybody has any code that I can look at in an existing solution that interfaces with Word that would be awesome. I usually learn better by looking at code and seeing what it does anyways. Thanx!