Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Insert a image into excel using VL lisp.

0 REPLIES 0
Reply
Message 1 of 1
Sea-Haven
146 Views, 0 Replies

Insert a image into excel using VL lisp.

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.

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


AutoCAD Beta