viewpoint-particle

Author Topic: excel add-ins  (Read 2997 times)

jheyman

  • Newbie
  • *
  • Posts: 3
excel add-ins
« on: August 05, 2013, 07:09:07 am »
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

  • Pundit
  • *****
  • Posts: 998
Re: excel add-ins
« Reply #1 on: August 05, 2013, 09:54:25 am »
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
While ! oXL.Ready
   TimeDelay(1)
EndWhile
oXL.Visible          = 1
 
 

jheyman

  • Newbie
  • *
  • Posts: 3
Re: excel add-ins
« Reply #2 on: August 05, 2013, 10:53:54 am »
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

  • Tech Support
  • *****
  • Posts: 3210
    • WinBatch
Re: excel add-ins
« Reply #3 on: August 05, 2013, 01:47:28 pm »
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