CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz] ARKANCE | CONTACT - CZ | SK | EN | DE
Over 1.095.000 registered users (EN+CZ). AutoCAD tips, Inventor tips, Revit tips. Try the new precise Engineering calculator. New AutoCAD 2026 commands and variables.

CAD tip CAD tip # 11580:

Question

CAD 
 %  platform  category 
A
With the following VBA macro you can use Excel to convert any Unicode text (cyrillic - russian, arabic, chinese, japanese, korean, greek and other two-byte characters) to encoded text for AutoCAD. Such encoded text can be then pasted into an AutoCAD text object. If such text object uses a text style based on an appropriate font (containing foreign-language characters), the text will be properly displayed in any AutoCAD version.

The custom function ACADunicode:

The code of the VBA function (Alt+F11 in Excel, Insert>Module):

Function ACADunicode(s)
cvt = ""
For i = 1 To Len(s)
 c = Mid(s, i, 1)
 x = StrConv(c, vbUnicode)
 If Mid(x, 2, 1) = Chr(0) Then
  cvt = cvt & c
 Else
  cvt = cvt & "\U+" & _
  Right("0" & Hex(Asc(Mid(x, 2, 1))), 2) & _
  Right("0" & Hex(Asc(Mid(x, 1, 1))), 2)
 End If
Next i
ACADunicode = cvt
End Function

You can invoke in Excel in a standard way, similarly as other embedded functions - e.g. =ACADunicode(A1) - converts the text from the cell A1.

The resulting text in AutoCAD:

ACADACLT
100% *CAD
28.8.2017    9932×  
applies to: AutoCAD · AutoCAD LT ·

See also:
Tip 14384:Wrong encoding of XLS/CSV/TXT files exported from CAD. Wrong characters on command line.
Tip 14238:How to combine fractions and subscripts/superscripts in MText?
Tip 13139:How to insert a new line into multiline text in the Find/Replace command?
Tip 12863:Do you know the difference among the fonts ISOCP, ISOCP2 a ISOCP3?
Tip 12782:How to insert a character in Kanji or Pinyin into Fusion 360?


Back    All CAD Tips



Have we helped you? If you want to support the CAD Forum web service, consider buying one of our CAD applications, or our custom software development offerings, or donating via PayPal (see above). You may also add a link to your web - like this "fan" link: CAD Forum - tips, utilities, blocks for Autodesk products
CAD: 
OS: 
Categ: 
Text:
 FAQ
  



Featuring:
Publish interactive 3D PDF models from AutoCAD, Inventor or Revit with Share3D More info


Please use these tips at your own risk.
ARKANCE is not responsible for possible problems that may occur as a result of using any of these tips.
TOPlist