Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What is the best way to initalize Word97 from VFP6?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00156542
Message ID:
00156718
Vues:
66
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform