Jump to content
Sign in to follow this  
litlmike

Excel COM into AutoIt Code

Recommended Posts

litlmike

Can someone give me an idea of how to turn this Excel Macro into AutoIt usable code? I thought my script below would work, but it doesn't... TIA

ActiveCell.FormulaR1C1 = "www.google.com"
    Range("E20").Select
    Selection.Hyperlinks(1).TextToDisplay = "Google"

#include <ExcelCOM_UDF.au3>
$oExcel = _ExcelBookNew()
    $oExcel.ActiveCell.FormulaR1C1 = "www.google.com"
    $oExcel.Range("E20").Select
    $oExcel.Selection.Hyperlinks(1).TextToDisplay = "Google"

Share this post


Link to post
Share on other sites
ptrex

@litlmike

If you want to run an existing macro in an Excel file.

You will need something like this.

; AutoRun Macro

Dim $objXL

$objXL = ObjCreate("Excel.Application")
  
    With $objXL.Application
        .Visible = True
        ;Open the Workbook
        .Workbooks.Open ("C:\Test.xls")
        $x = .Run("MyMacroName") ; MacroName, Parameters1, Parameter2, ...
    EndWith

regards

ptrex

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×