Automatically Starting Microsoft Excel Macros Through OLE

ID: Q98701


The information in this article applies to:


SUMMARY

Microsoft FoxPro for Windows can load and run a Microsoft Excel 4.0 macro from a general field. The information below provides the steps for using the Auto_Activate Microsoft Excel macro.

NOTE: These steps do not work with Excel versions greater than 4.0.


MORE INFORMATION

The Auto_Activate macro executes when a Microsoft Excel macro sheet is activated.

To create this macro, do the following:

  1. Create a database in FoxPro with a general field.


  2. Open the general field in FoxPro, and choose Insert Object from the Edit menu.


  3. From the Insert Object list, choose Microsoft Excel Macrosheet. (Microsoft Excel must be a registered server application in order for this option to be available.)


  4. In cell A1, type the following:
    
           =ALERT("This is the Auto_Activate") 


  5. In cell A2, type the following:
    
           =RETURN() 


  6. Select cell A1.


  7. From the Formula menu, choose Define Name. In the Name box, type "Auto_Activate" (without the quotation marks).


  8. In the Macro section of the Define Name dialog box, select Command.


  9. In the Refers To box, type "=$A$1" (without the quotation marks).


  10. In the Category box, make sure User Defined is selected.


  11. Choose Add and then choose OK.


  12. From the File menu, choose Exit, and choose Yes to update the macro sheet.


When selected, this general field will now start Microsoft Excel and run the Auto_Activate macro.

Additional query words: FoxWin 2.50 Excel OLE DDE macrosheet


Keywords          : FxinteropDde 
Version           : 2.50 2.50a
Platform          : WINDOWS 
Issue type        : 

Last Reviewed: August 8, 1999