Jump to content

Excel COM into AutoIt Code


Recommended Posts

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"
Link to comment
Share on other sites

@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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...