excel add-ins

Started by jheyman, August 05, 2013, 07:09:07 AM

Previous topic - Next topic

jheyman

I am trying to open an existing excel file using winbatch

The problem is that Excel doesn't load all the addins that load when I open Excel normally...Is there anything in the Excel Application object for loading in all the addins?

I'm trying to make Excel behave as though the user opened it normally manually.

so far i have the below code but i don't know how to get the add-ins to load:

opath="g:\users\path\"
source_xls = "%opath%xyzexcel.xls"
ExcelWS = ObjectOpen("Excel.Application")
EWS = ExcelWS.Application
EWS.visible = @true
EWS.DisplayAlerts =@FALSE
EWB = EWS.Workbooks
EWB.Open("%source_xls%")
xlCSV = 6
WBA = ExcelWS.ActiveWorkbook
WBA.SaveAs(::FileName="g:\users\path\xyzexcel.csv",FileFormat=%xlCSV%,CreateBackup=0)
exit

stanl

Most likely a timing issue, and if you are using Office 2010/2013 with add-ins like PowerPivot your code would most likely error.  Need to put in a loop before making Excel visible.
Code (WINBATCH) Select

While ! oXL.Ready
   TimeDelay(1)
EndWhile
oXL.Visible          = 1


jheyman

i am using excel 2003 - i tried the timedelay - it didn't help -  i don't think it is a timing issue - when you launch excel via winbatch the addins won't automatically launch with the program.  I believe they have to be loaded.  I'm just not sure how.

td

I would tend to agree with Stan.  IIRC, they are loaded based on registry key entries on a per user basis.  Perhaps it is a wrong user issue or something.

Anyway, here is a link to a Tech Support article that show how to add add-ins to Excel via its COM Automation interfaces.

http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+WinBatch/OLE~COM~ADO~CDO~ADSI~LDAP/OLE~with~Excel+Create~Excel~Addin.txt
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade