VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Handles getting modified when put in excel

22 REPLIES 22
Reply
Message 1 of 23
mdhutchinson
563 Views, 22 Replies

Handles getting modified when put in excel

One of the command buttons in the application I am working on exports data to a CSV file. In the data that is exported, I have several fields, one of which is for the DrawingName and another for the EntityHandle... The functionality that I built into the app allows the user to double click a line in the listbox and the application will (zoom) the user to the correct drawing and entity which the row in the list box references. I have this ‘Show entity’ functionary working well… and I am quite happy with it.

In AutoCAD and in my application's GUI, the handles show correctly as 1011E9 and 1011E2... but in the exported data in the CSV file the data reads as 1.01E+12 and 1.01E+05. Note: I am using Excel type library to do the work of exporting the data to create the CSV file… and I really don’t want to change to some other non-Excel approach.

I have yet to develop the code that will bring this data (after editing by an external enterprise application) back into my application… but when I do I need for the entity handles to remain as it was so that this zoom feature will continue to work.

The data comes from an object for which I created a Class module for with Property Let and Set Procedures. The Property’s data type for the Handle property is String, but yet in the trip to the CSV file the value of the field is getting evaluated as scientific notation because of the occurrence (apparently) of the ‘E’.

Any ideas as to how I might fix this?
22 REPLIES 22
Message 21 of 23
mdhutchinson
in reply to: mdhutchinson

you could improve this by sumbiting an Undo step to undo the text rotation to align the WCS ... I actually thought of this for my case also...
Message 22 of 23
mdhutchinson
in reply to: mdhutchinson

thought I should chime in here again...

I (with some help from another source) discovered another way to get excel to quit evaluating AutoCAD handles of the form ####E#.
When the handle field is written to excel, instead of writing 1011E9 , write '1011E9

"`" & Handle

this works well... but obviously... program code that reads from the excel file needs to strip the apostrophe off.
Message 23 of 23
LanKhuong
in reply to: mdhutchinson

Add a single quote before the Handle string before putting it into Excel:

Range("A1") = "'014E12"

Excel will treat this as text.

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

Post to forums  

Autodesk Design & Make Report

”Boost