Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Want to insert a picture to Excel file using Autolisp:
(setq Path (getvar "dwgprefix"))
(setq ExFile (strcat Path "TestP.xlsx"))
(if ExFile
(progn
(setq excel-app (vlax-get-or-create-object "Excel.Application"))
(vla-put-visible excel-app :vlax-false)
(vlax-put-property excel-app "ScreenUpdating" :vlax-false )
(setq wbook-coll (vlax-get-property excel-app "Workbooks"))
(setq wbook (vlax-invoke-method wbook-coll 'Open ExFile))
(if (or (null wbook) (vl-catch-all-error-p wbook))
(progn
(alert "Can not find ExcelFile ")
(vlax-put-property excel-app "ScreenUpdating" :vlax-true )
(vlax-invoke-method wbook-coll "close" ) ; close
(vlax-invoke-method excel-app "quit" ) ; Quit
)
(progn
(setq sheet-coll (vlax-get-property wbook "Sheets"))
(setq TruesheetDist (vlax-get-property sheet-coll "item" 1))
(setq Cells (vlax-get TruesheetDist "cells"))
; Here want to insert a picture (knowing its path and name) in the "TruesheetDist"
Solved! Go to Solution.