Jump to content

Recommended Posts

Posted

Hi there

I know a lot of similar subjects there, but I need help to edit the lisp that I am using, It gives me text from AutoCAD to excel by clicking on it, even if it's Block, Attribute, Mtext or text any kind of text.

but It can't change the AutoCAD text colour after clicking, anyone  have any solution please let me know, i attach the lisp below.

TEXT2XL.png

Text2XLS & Click2Xls.vlx

Posted

Can you post the LISP without the protection (as a LISP file).... tricky to help out otherwise.

 

Not sure if you can alter the colour in excel - you'll have to put the colour code in the text so that excel recognises it as it opens

Posted

I had a play. Not sure about the numbers produced, get funny answer for RED. Cell 1 4 returns color 0 index 1 which sounds correct. 

(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)
(setq cells (vlax-get-property  (vlax-get-property myxl "ActiveSheet") "Cells"))

repeat these 2 lines change column number
(setq cell (vlax-get (vlax-variant-value  (vlax-get-property cells "Item" 1 1)) 'font)) ; row column 1 1
(alert (strcat "Color is  " (rtos (vlax-get cell 'color) 2 0) " Index " (rtos (vlax-get cell 'colorindex) 2 0)))

 

(vlax-put cell 'color  5287936.0)

 

image.png.e2b1230f9676ce13252ceac24cea35f1.png

 

Posted

@BIGAL Thanks a lot, you are always a life saver, I'm not good as you in coding.

 

The thing I want is to change the text colour only in AutoCAD once I select it ,besides that it works perfect

Posted

If you dont have the source of the VLX we can not help you, its a case of look at this code.

 




Yes its blank, that means some one has to start with a blank sheet and write all new code. 

 

You need to explain more what values need to have their color changed. Is it just all that you select  to one color ? The send to Excel is the easy bit.

  • Like 1

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...