Jump to content

Extracting data to excel from selected objects on different layers


Recommended Posts

Posted (edited)

Added to my to do list may be a couple of days.

 

1st comment would do alphabetically for objects. So Mtext is before Text.

 

You are lucky that I have get objects properties code.

Edited by BIGAL
  • 3 weeks later...
Posted (edited)

Ok the "add" is only needed if you start excel as it would normally ask to select a fiel including "Blank", if you have Excel already open it will find current workbook.

 

I need to put the add in correct spot not sure why I did not do before. This should work just replace in code.

; Count will be 0 if no excel open but if no workbooks also may return same value. Nil names. 
; So a double check count /=0 and wb not ""

(princ "\nOpening Excel...")

  ;; Try to get or create Excel instance
(setq myxl (vl-catch-all-apply 'vlax-get-or-create-object '("Excel.Application")))
  (if (vl-catch-all-error-p myxl)
    (progn
      (prompt "\nError: Could not start Excel.")
      (exit)
    )
  )
(if (=  (vlax-get-property  (vlax-get-property myXL 'WorkBooks) 'count) 0)
    (vlax-invoke-method (vlax-get-property myXL 'WorkBooks) 'Add)
)
(vla-put-visible myXL :vlax-true)
(vlax-put-property myxl 'ScreenUpdating :vlax-true)
(vlax-put-property myXL 'DisplayAlerts :vlax-true)

 

Edited by BIGAL

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...