Word Object Model

M

Mark

I am having alot of difficulty working with the Word Object Model. Could
someone please provide links (or anything) that they know of that is helpful
in understanding it. I have tried Microsoft help, but too circular for me
(eg, when I look up bookmark, it tells me they are part of the bookmarks
collection....when I look up bookmarks, says that its a collection of
bookmarks....but nowhere tells me what one is/does). I would greatly
appreciate any help on this....I am tasked with creating and appending to
documents on the fly, with some fairly involved formatting as well.

And I appear to be very stuck.
TIA.
 
P

Peter Huang [MSFT]

Hi

I think you may try to reference to the work's OM helper file which has
some code snippet.
<Program Files>\Microsoft Office\OFFICE11\1033\VBAWD10.CHM

e.g.
Use the Add method to add a bookmark to a document range. The following
example marks the selection by adding a bookmark named "temp."

ActiveDocument.Bookmarks.Add Name:="temp", Range:=Selection.Range

Also a simple method would be using the Word's Record Macro function.
e.g.
1. Start Record macro(Tools/Macro/Record New macro)
2. Insert/Bookmark to do it manually
3. Stop record macro
4. Press Alt+F11 to view the Macro generated just now which is concern
about how to insert Bookmark programming.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
M

Mark

Peter,

I appreciate your effort, but like my other posting, I just dont think you
are reading my questions correctly. I have found that the help file you refer
to is the very one I find not useful to me. I stated this, and explicitly
asked for a DIFFERENT resource.

I see you've written a fair amount with respect to adding bookmarks, and
running macros. I dont know why you've done that. It is not what I've asked
about. I actually used bookmarks as an example of how unhelpful the Microsoft
help file is! Notwithstanding what you wrote, I still do not have an
understanding of what a bookmark is, or is supposed to do, or how it ties in
with everything.

I would very much appreciate some help on where to go for a good
understanding of the Word Object Model other than microsoft help files. But
please, stop referring me to the help files. Thank you.
 
C

Cindy Meister

Hi Mark

Probably your best resource for this would be discussing Word's internal
workings in a word.vba newsgroup, where you'll get the practical experience
of a plethora of people who use and automate Word, day-in, day-out. You'll
have to learn how to "translate" the VBA to whichever language you're using.
(You never did answer me on that. Believe it or not, I can help you, even
with C# syntax. But you have to be ready for some give-and-take.)

On-line, your best resource is probably word.mvps.org and related/linked
sites. Often, where to find it depends on what object you're interested in.
Word folks tend to specialize somewhat, depending on what their jobs require
of them.

Other than that, material aimed at the end-user might be of more help to you
for "how it works" than developer material. Word's object model evolved from
the user interface. And the internal workings of a lot of things date back
some fifteen to twenty years.

And yes, you're looking at a pretty steep learning curve :)

-- Cindy
 
P

Peter Huang [MSFT]

Hi

I think if you want to have a common sense of word, you may try to read
some books as below as Cindy's suggestion.
This queue is for Office Development, which discuss how to do the job by
code.
e.g. How to add bookmark, how to insert text into word document.

The VBA helper file is the base of the Word's Object Modal, we program
against the Word based on the document, e.g. when to use which interface
Word's OM will expose to help to complete our work.

Microsoft Word 2003
http://www.amazon.com/exec/obidos/tg/detail/-/B0000BZ54V/qid=1123064510/sr=8
-1/ref=pd_bbs_1/104-4771245-1502323?v=glance&s=software&n=507846

Word 2003: Vba Programming
http://www.amazon.com/exec/obidos/tg/detail/-/0619205369/qid=1123064635/sr=8
-1/ref=sr_8__i1_xgl14/104-4771245-1502323?v=glance&s=books&n=1000

Word 2003 Document Automation with VBA, XML, XSLT, and Smart Documents
http://www.amazon.com/exec/obidos/tg/detail/-/1556220863/qid=1123064635/sr=8
-3/ref=sr_8__i3_xgl14/104-4771245-1502323?v=glance&s=books&n=1000

If you still have any concern, please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
M

Mark

Peter,

Thank you for the info on resources. Very much appreciated! And I will look
at posting in the other groups, as you suggest.

Cheers,
 
P

Peter Huang [MSFT]

Hi

Thanks for your quickly reply!
You are welcomed!


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top