Reputation: 11
I need to open the encrypted excel file from code, and the end user can also edit or save the opened file. Then I found a way to handle it by using com:
However, The opened excel application does not support excel addins.
for example: the excel setting like
excel setting 1 excel setting 2
when open excel.exe normally,it's like:
but when use com to open excel.exe by the code, it's like:
the addins disappear.
Also, if you reconfig addins option, addins appear again. So I think there may have no initialization when excel.exe was started.
Is there any way to start open encrypted excel file by excel.exe from code, and all excel function are fine?
Here is the code with vbs(the link below is c code):
Set oExcel = CreateObject("Excel.Application")
Set oWorkbook = oExcel.Workbooks.Open("C:\Users\melon\Desktop\excel\excel tests\chat&sample exam.xlsm", 0, 0, 5, "76350e01-a0bd-44c6-9e4d-0df382c2d789")
oExcel.Visible = true
Upvotes: 0
Views: 54
Reputation: 142
Programs started with COM are started by COM with the slash /a
parameter. This means Automation is starting the program so it should load clean.
/a
Starts Word and prevents add-ins and global templates (including the Normal template) from being loaded automatically. The /a switch also locks the setting files.
Upvotes: 0