Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Vfp and word
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Divers
Thread ID:
00428455
Message ID:
00441534
Vues:
19
>Thanks for all of your help. Using the following I'm able now to open
>Word.Basic. using the following

One word of caution with Word.Basic: that was around for Word 95, and is not the most current way to do things. While it works, it may not be supported in future releases. Rather than use the Word.Basic object, you should be using the Word.Application object:

Instead of:
>#DEFINE wdPaperLetter 2
>oWord = CREATEOBJECT("Word.Basic")		&&Is the BASIC functions
>oWord.AppShow()
>oWord.AppMaximize()
>oWord.FileNewDefault()
>oWord.TogglePortrait
>oWord.FilePageSetup.PaperSize = wdPaperLetter
try
#DEFINE wdWindowStateMaximize   1
#DEFINE wdOrientationPortrait   0
#DEFINE wdPaperLetter    2
oWord = CREATEOBJECT("Word.Application")
WITH oWord
  .Visible = .T.
  .WindowState = wdWindowStateMaximize
  oDoc = .Documents.Add()
ENDWITH

WITH oDoc.PageSetup
  .Orientation = wdOrientationPortrait
  .PaperSize = wdPaperLetter
ENDWITH
This also takes care of the FilePageSetup problem, as that object doesn't exist (sorry I didn't catch that in the first message).

You also asked for more information about the Object Browser. Here's some of what Tamar Granor and I have to say about the object browser in our book, "Microsoft Office Automation with Visual FoxPro":

"One of the most powerful tools available for figuring out Automation code is the Object Browser... It lets you drill into the various objects in the hierarchy to determine their properties and methods, see the parameters for methods, determine the values of constants, and more.

"The easiest way to find out about a specific item is to type it into the search dropdown, then press Enter or click the Find (binoculars) button. The middle pane fills with potential matches. Choose one to learn more about it in the main section of the Browser underneath. The left pane is filled with the properties, methods, collections, and constants. The right pane describes what’s available for the highlighted item in the left pane. In Figure 5, the Object Browser has been used to determine the value of the constant wdWord. In the bottom-most pane, you can see that it’s a constant with a value of 2."

Sorry, I can't stick Figure 5 in here, but I can tell you that you get to the Object Browser, inside of Word, you select: Tools|Macro...|Visual Basic Editor (or Alt-F11), and once inside the VBE, select View|Object Browser (or F2). The Search dropdown is the second dropdown; type something in, such as "wdWindowState" and it returns all the matches. In this case, you'll see all the available constants and their values.

If you're interested in the book, see www.hentzenwerke.com. If you order through Hentzenwerke, you can have the text of the book in a .CHM file by this afternoon, while waiting for the paper copy to be shipped. You'll probably find it very helpful.

Let me know if there's anything else I can help you with.

- della Martin
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform