gtheys Posted January 12, 2011 Share Posted January 12, 2011 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. Link to comment Share on other sites More sharing options...
gtheys Posted January 12, 2011 Author Share Posted January 12, 2011 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now