OLE Excel SOS
Forum rules
This forum is for discussing APL-related issues. If you think that the subject is off-topic, then the Chat forum is probably a better place for your thoughts !
This forum is for discussing APL-related issues. If you think that the subject is off-topic, then the Chat forum is probably a better place for your thoughts !
5 posts
• Page 1 of 1
OLE Excel SOS
Hello,
I have difficulty understanding the logic of transcription, in Dyalog V15, of macros' Excel 2013, especially for cases which seem to me simple.
Example:
Macro Excel 2013
ActiveSheet.Pictures.Insert("G:\Gestcf20162017\PhotoEnc\20800120802.bmp").Select
That I have transcribe under Dyalog :
⎕WX←1
⍎'ActiveSheet.Pictures.Insert',(∊#.SPhot[I]),'.Select'
with the next result :
⍎SYNTAX ERROR
ActiveSheet.Pictures.Insert('G:\Gestcf20162017\photoenc\20800120802.bmp').Select
Why this error?
Regards
Bertrand Delassus
I have difficulty understanding the logic of transcription, in Dyalog V15, of macros' Excel 2013, especially for cases which seem to me simple.
Example:
Macro Excel 2013
ActiveSheet.Pictures.Insert("G:\Gestcf20162017\PhotoEnc\20800120802.bmp").Select
That I have transcribe under Dyalog :
⎕WX←1
⍎'ActiveSheet.Pictures.Insert',(∊#.SPhot[I]),'.Select'
with the next result :
⍎SYNTAX ERROR
ActiveSheet.Pictures.Insert('G:\Gestcf20162017\photoenc\20800120802.bmp').Select
Why this error?
Regards
Bertrand Delassus
- Tranber44
- Posts: 36
- Joined: Mon Jan 11, 2010 4:46 pm
Re: OLE Excel SOS
Many .Net programs (methods) need the string to be enclosed.
Try adding an "enclose" (⊂) before the string and reordering the parentheses, as in
ActiveSheet.Pictures.(Insert⊂'G:\Gestcf20162017\photoenc\20800120802.bmp').Select
Try adding an "enclose" (⊂) before the string and reordering the parentheses, as in
ActiveSheet.Pictures.(Insert⊂'G:\Gestcf20162017\photoenc\20800120802.bmp').Select
- DanB|Dyalog
Re: OLE Excel SOS
Hello,
Thank you for having answered my problem but the proposed solution does not work. I tried with ⎕WX←3 but unsuccessfully.
ActiveSheet.Pictures.Insert[⊂'G:\Gestcf20162017\photoenc\20800120802.bmp'].Select
VALUE ERROR
I discourage to find the good formulation.
Regards
Bertrand Delassus
Thank you for having answered my problem but the proposed solution does not work. I tried with ⎕WX←3 but unsuccessfully.
ActiveSheet.Pictures.Insert[⊂'G:\Gestcf20162017\photoenc\20800120802.bmp'].Select
VALUE ERROR
I discourage to find the good formulation.
Regards
Bertrand Delassus
- Tranber44
- Posts: 36
- Joined: Mon Jan 11, 2010 4:46 pm
Re: OLE Excel SOS
Hello, I have tried to make it work with OLE and I could not make it work either. However I have been able to make it work with the Syncfusion assembly as explained here.
There is also a namespace on the AplWiki about using the Syncfusion assembly to emulate the Microsoft Excel program here
Regards,
Pierre Gilbert
- Code: Select all
⎕using←'Syncfusion.XlsIO,Syncfusion/4.5/Syncfusion.XlsIO.Base.dll'
excelEngine←⎕new ExcelEngine
application←excelEngine.Excel
application.DefaultVersion←ExcelVersion.Excel2013
workbook←application.Workbooks.Create 1
worksheet←workbook.Worksheets[0]
shape←worksheet.Pictures.AddPicture( 1 1 'd:\MyImage.bmp')
workbook.SaveAs(⊂'d:\MyFile.xlsx')
workbook.Close ⍬
excelEngine.Dispose
There is also a namespace on the AplWiki about using the Syncfusion assembly to emulate the Microsoft Excel program here
Regards,
Pierre Gilbert
-
PGilbert - Posts: 440
- Joined: Sun Dec 13, 2009 8:46 pm
- Location: Montréal, Québec, Canada
Re: OLE Excel SOS
I got it to work with OLE:
I played a bit with this and found that VBA uses
Does that help?
I played a bit with this and found that VBA uses
- Code: Select all
activesheet.Shapes.AddPicture Filename:="C:\test\desert.jpg", linktofile:=msoFalse, savewithdocument:=msoCTrue, Left:=0, Top:=0, Width:=100, Height:=100
- Code: Select all
XL.ActiveSheet.Shapes.AddPicture'C:\Users\danb\Pictures\YUL-YVR\DSC05964.jpg' 0 1 0 0 100 100
Does that help?
- DanB|Dyalog
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group