Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What is the best way to initalize Word97 from VFP6?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00156542
Message ID:
00156718
Views:
55
Juan,

I just tweaked a section of code I have:
* startup Word
set classlib to msoffice.vcx additive

local loWord
this.moWordHelper = createobject( "WordHelper", @loWord )

if ( ! IsObject( loWord ) )
   return .f.
endif

this.moWord = loWord

with this.moWord
   local lcFile
   lcFile = fullpath( curdir() ) + "work order.dot"
   this.moWorkOrder = .Documents.Add( (lcFile) )

   with this.moWorkOrder.PageSetup
      .LineNumbering.Active = .t.
      .LeftMargin   = this.moWord.InchesToPoints( 0.5 )
      .RightMargin  = this.moWord.InchesToPoints( 0.5 )
      .TopMargin    = this.moWord.InchesToPoints( 0.3 )
      .BottomMargin = this.moWord.InchesToPoints( 0.3 )
   endwith
And it turns on or off LineNumbering just like it should. Are you using original Office97 or SP1 or SP2 version? I'm on SP1, and running this code from VFP5 SP3.

What if you don't do it as a function? Are oWord and oWordDoc local memvars? I have passed a reference to a word table object to a method and used it quite happily.

The error indicates that you aren't working with the object you think you are. What's different about when it works and when it doesn't?

>Your assumption is correct the clip is oWordDoc = oWord.Documents.Add().
>
>The error message returned by VFP6 is "Member LINENUMBERING does not evaluate to an object"
>
>I've tried moving some of the settings within the WITH..ENDWITH block, but that did not help.
>
>What is really funny about this, is that sometimes it works and sometimes it does not. It's just like the "Mounds/Almond Joy" commercial, sometimes I feel like a nut and sometimes I don't!
df (was a 10 time MVP)

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

Click here to load this message in the networking platform