I am trying to convert a excel macro function to a VL function the task is to insert an image file like jpg,png into a cell.
Sub Macro1()
Dim strFile As String
strFile = Application.GetOpenFilename(FileFilter:="Excel files (*.png*), *.jpg*", Title:="Choose an image file to open", MultiSelect:=False)
ActiveSheet.Pictures.Insert(strFile).Select
End Sub
So I have no problems talking to Excel, getting and putting cells etc.
It is this I need to convert not the getfile
ActiveSheet.Pictures.Insert(strFile).Select
Ok some hints when you add a picture to a spreadsheet it lives in the Shapes collection.
; this will open excel or connect to a open excel
(or (setq myxl (vlax-get-object "Excel.Application"))
(setq myxl (vlax-get-or-create-object "excel.Application"))
)
(vla-put-visible myXL :vlax-true)
(vlax-put-property myxl 'ScreenUpdating :vlax-true)
(vlax-put-property myXL 'DisplayAlerts :vlax-true)
This will dump the properties
(vlax-dump-object (vlax-get-property myxl "ActiveSheet") T)
If you have some images inserted and dump the Shapes property it will show a count of how images are in the excel.
I am pretty sure need to add to the shapes somehow, then put it in a cell. Thats where I have got to.