Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Vfp and word
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Miscellaneous
Thread ID:
00428455
Message ID:
00441024
Views:
14
Darrell,
You've got several problems, all of which are commonly made mistakes. Here are some suggestions:

Looks like you're trying to use VB/VBA's named parameters, which VFP doesn't support. For example
>ox = createobject("word.document")
>With OX
>  mydoc = .Document.Add
>EndWith
>MyDoc.SaveAs FileName:="C:\Temp.doc"
That last line should read:
MyDoc.SaveAs("C:\Temp.doc")
There's a good KB article on most everything you need to do to convert VBA to VFP, at http://support.microsoft.com/support/kb/articles/Q160/0/64.asp (#Q160064, if the link doesn't work).


>loAppSearch=CREATEOBJECT("Word.document.6")
>AppSearch=loAppSearch.FileSearch

As far as the FileSearch problem...you're creating a Document (in version 6?? is this a supported feature in Word 6? I don't know...and don't have the docs in front of me). The FileSearch object is subordinate to the Application. Try:
loApp = CreateObject("Word.Application")
loAppSearch = loApp.FileSearch
>ox = createobject("word.document")
>ox.FilePageSetup.PaperSize = 'Letter'

Here you need to set the PaperSize property to a constant. VBA makes use of intrinsic constants, which we must #DEFINE in VFP. In this case, you need to amend the previous code to:
#DEFINE wdPaperLetter 2
ox = createobject("word.document")
ox.FilePageSetup.PaperSize = wdPaperLetter
The constant values can be found in the object browser: in Word, go to the VB Editor (Alt-F11), then press F2 to bring up the object browser. Type in the name of the constant, and it'll show a list of all the related constants and their values.

Hope this helps!

- della Martin
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform