A family of Microsoft word processing software products for creating web, email, and print documents.
Thanks for posting that - it will come in quite useful :)
I have already added the following to my useful macros add-in.
Sub AnsiCode()
Dim myData As DataObject
Dim vChar As Variant
Dim sCode As String
Set myData = New DataObject
For Each vChar In Selection.Characters
sCode = sCode & "ChrW(" & AscW(vChar) & ") & "
Next
sCode = Left(sCode, Len(sCode) - 3)
MsgBox sCode & vbCr & vbCr & "Copied to clipboard!"
myData.SetText sCode
myData.PutInClipboard
End Sub
<Tony Jollans [MVP]> wrote in message news:*** Email address is removed for privacy ***...
As others have said you cannot really do this. The VBA editor is an ANSI
(non-Unicode) text editor and the only options you have are characters in
the basic ASCII set plus those in whatever code page you are using. Any code
point higher than 255 and you need to use the CHrW method.
If you have a lot of this to code up it would probably be worth writing a
little routine to pull text from a document body and generate the code -
just something simple for your own use like this would, at least, avoid
mistakes ..
For Each char In Selection.Characters
code = code & "ChrW(" & AscW(char) & ") & "
Next
.. and you could then copy the code from the immediate window and into its
proper place, but you could make it more sophisticated if you wanted to.
Enjoy,
Tony
"cispas2000" wrote in message
news:*** Email address is removed for privacy ***...
Hello, how can I easily insert special characters from other language (Èâ"¢,
Èâ?º, î, ÄÆ', â) within the VBA script instead of ChrW(537) or ChrW(539)?
<!-- [if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View>
<w:Zoom>0</w:Zoom> <w:TrackMoves/> <w:TrackFormatting/>
<w:HyphenationZone>21</w:HyphenationZone> <w:PunctuationKerning/>
<w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/> <w:LidThemeOther>RO</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/>
<w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/> <w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/> <w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/> <w:CachedColBalance/> <w:UseFELayout/>
</w:Compatibility> <m:mathPr> <m:mathFont m:val="Cambria Math"/> <m:brkBin
m:val="before"/> <m:brkBinSub m:val="--"/> <m:smallFrac m:val="off"/>
<m:dispDef/> <m:lMargin m:val="0"/> <m:rMargin m:val="0"/> <m:defJc
m:val="centerGroup"/> <m:wrapIndent m:val="1440"/> <m:intLim
m:val="subSup"/> <m:naryLim m:val="undOvr"/> </m:mathPr></w:WordDocument>
</xml><![endif]-->
The below string should be: Èâ"¢tiu cÄÆ' pot rezolva asta, dar cine îÈâ?ºi va
spune cum? Èâ"¢tie cineva Èâ?ºara?
VBA script:
Sub Macro1()
'
' Macro1 Macro
'
'
Selection.TypeText Text:=ChrW(537) & "tiu cÄÆ' pot rezolva asta, dar
cine î" _
& ChrW(539) & "i va spune cum? " & ChrW(537) & "tie ci"
Selection.TypeText Text:="neva " & ChrW(539) & "ara?"
Selection.TypeParagraph
Selection.TypeParagraph
End Sub
thanks
Enjoy,
Tony
Graham Mayor - Word MVP
Posted via the Communities Bridge