Jump to content
Sign in to follow this  
gtheys

Loading Excell Addin

Recommended Posts

gtheys

I tried:

$sAddIn = "H:\prog\essxleqd.xla"
$oExcel = ObjCreate("Excel.Application")
$oExcel.Visible = 1
$oExcel.WorkBooks.Add
$oAddIn = $oExcel.AddIns.Add($sAddIn)
$oAddIn.Installed = True
$oExcel.WorkBooks.Open("H:\Balance_Inquiry.xls")

When I do:

<code>

Run('"c:\pathtoexcel\excel.exe" "c:\pathtoaddin\addin.xla"')

</code>

It will work. But I prefer the former solution because I need to different things in excel and this will be easier.

Share this post


Link to post
Share on other sites
gtheys

UPDATE:

$sAddIn = "H:\prog\essxleqd.xla"
    $oExcel = ObjCreate("Excel.Application")
    $oExcel.Visible = 1
    $oExcel.WorkBooks.Add
    $oAddIn = $oExcel.AddIns.Add($sAddIn)
    $oAddIn.Installed = False
    $oAddIn.Installed = True
    $oExcel.WorkBooks.Open("H:\Balance_Inquiry.xls")

This seems to do the trick. Seems the first time when I ran the script it got installed and worked. Afterwards it didn't.

Weird part is that even when it is installed it doesn't execute second time. So each time I have to do the False part...

Maybe someone can explain or provide a more elegant solution.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.