Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Doing the DDE dance with MapInfo
Message
From
29/05/1998 11:47:35
Ryan Hirschey
Federal Reserve Bank of New York
New York City, New York, United States
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00102759
Message ID:
00103134
Views:
25
>Did this VBA replace WordBasic, or is it something different? It's been about 2 years since I made macros in Word, so things probably changed in the 2 versions since then.
>
>The OLE in the online docs talks mostly about embedding objects. I don't think that's quite what I want to do. I don't need to embed something in a form, I need to run MapInfo from VFP code. Or is it the same thing and I'm just not seeing it?
>
>Is there any books on OLE and VFP?
>
>Thanks,

Yes, VBA has replaced WordBasic to make MS Word more like the other Office products. VBA is in all the other products, I believe, except for maybe Outlook , which might use VBScript (notice all the variants of VB out there.)

Here's a small example of controlling Excel from VFP using code only (no linking or embedding). It's from the online help, Chapter 16 for VFP5. (Try searching for automation. You'll probably get better results):

Using Extrinsic Object Methods

In addition to setting and retrieving properties of objects, you can manipulate an object using methods it supports. For example, you can use the Add method of a Microsoft Excel collection object to create a new Microsoft Excel workbook.
The following Automation example uses the Add method to create an Excel workbook, the Save method to save the workbook, and the Quit method to end Excel:

Code Comments

oleApp = CREATEOBJECT("Excel.Application") &&Start Excel.
OleApp.Visible=.T. &&Display Excel.
OleApp.Workbooks.Add &&Create a workbook.
OleApp.Cells(1,1).Value=7 &&Set a cell’s value.
OleApp.ActiveWorkbook.SaveAs("C:\TEMP.XLS") &&Save the workbook.
OleApp.Quit &&Quit Excel.
If you create an object using the OLE Container control or OLE Bound control, you can use the DoVerb method of the control to execute a verb on the object. For example, use DoVerb(0) to execute the default verb, DoVerb(– 1) to activate the object for visual editing, and DoVerb(– 2) to open the object in a separate window.
Note See an application’s documentation to determine what Automation commands it supports. For example, Microsoft Excel add-in components are not available for Automation.
Ryan Hirschey
Previous
Reply
Map
View

Click here to load this message in the networking platform