Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can we subclass word.application?
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Title:
Can we subclass word.application?
Miscellaneous
Thread ID:
00144385
Message ID:
00144385
Views:
58
Now that I've worked a little with oWord = createobject( "word.application" ) I'd like to add some methods to it to make life easier. Like add an EraseDocument() which would just do the couple of lines of VBA calls that it takes.

What I've done so far is create a subclass WordHelper based on my cObject(Line) subclass that instantiates word and gets created like:
local loWord
this.moWordHelper = createobject( "WordHelper", @loWord )

if ( ! IsObject( this.moWordHelper ) )
   * it already complained about Word not found so just quit
   return .f.
endif

this.moWord = loWord
This kind of gives a dual interface you can talk to the word object directly using this.moWord (or this.moWordHelper.moWord but I don't like typing that much *s*) or to the Helper functionality using this.moWordHelper.EraseDocument() but I'm not sure I'm totally pleased with this and looking for suggestions. I don't really want to completely wrap moWord that's just too daunting dealing with all of it's interface methods and properties.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Next
Reply
Map
View

Click here to load this message in the networking platform