Trying to Find and Compare Pasted Chinese Character
Trying to Find and Compare Pasted Chinese Character
Trying to Find and Compare Pasted Chinese Character
Trying to Find and Compare Pasted Chinese Character
Trying to Find and Compare Pasted Chinese Character
Trying to Find and Compare Pasted Chinese Character Trying to Find and Compare Pasted Chinese Character Trying to Find and Compare Pasted Chinese Character Trying to Find and Compare Pasted Chinese Character Trying to Find and Compare Pasted Chinese Character Trying to Find and Compare Pasted Chinese Character Trying to Find and Compare Pasted Chinese Character Trying to Find and Compare Pasted Chinese Character
Trying to Find and Compare Pasted Chinese Character Trying to Find and Compare Pasted Chinese Character
Trying to Find and Compare Pasted Chinese Character
Go Back  Xtreme Visual Basic Talk > > > > Trying to Find and Compare Pasted Chinese Character


Reply
 
Thread Tools Display Modes
  #1  
Old 02-28-2012, 02:17 PM
JaredHess JaredHess is offline
Regular
 
Join Date: Jul 2003
Posts: 83
Question Trying to Find and Compare Pasted Chinese Character


I have a VBA Word macro in Office 2010 that takes a user input via an InputBox and stores the string and then searches for that string inside a Word document to delete text of a specific style following the inputted string.

However, the actual string is never "found" via the macro if I paste in some Chinese (simplified) characters, even though they are indeed found if I manually use Word's native find functionality. It does work fine in English, German, Spanish etc...

I believe this has something to do with multibyte characters not being supported or enabled or something inside of my macro; because if I step through my code, the tooltip for the variable storing the string shows the passed string as three question mark symbols: ??? even though they correctly displayed inside the InputBox.

From what I've read on this site, it sounds like the reason ??? symbols are appearing are because the Microsoft Visual Basic for Applications code editor I'm using isn't configured to support multibyte characters. Is that correct? Is there a way to enable this?

Or do I need to convert my code or something to support unicode...?: Sorry, I'm not all that knowledgeable with character encodings etc. What do you recommend to get this working?

Here's part of my code:
Code:
Sub multibyte_delete_more_linking_text()

    'This script will search for a specified "more" string and then delete empty paragraphs
    'or hyperlink text after it until it hits a heading style string.
    Selection.HomeKey Unit:=wdStory
    
    strText = InputBox("Type the ""More"" text to search for", "More Heading To Find", "More:")
        
    strText = strText & Chr(13)
    ' Now it finds the text
    
        Selection.Find.ClearFormatting
        With Selection.Find
            .Text = strText
            .Replacement.Text = ""
            .Forward = True
            .Wrap = wdFindContinue
            .Format = False
            .MatchCase = False
            .MatchWholeWord = False
            .MatchByte = False
            .MatchAllWordForms = False
            .MatchSoundsLike = False
            .MatchWildcards = False
            .MatchFuzzy = False
        End With
        
        Selection.Find.Execute

.... and so on....
Thanks in advance for your help.

Last edited by JaredHess; 02-28-2012 at 02:25 PM.
Reply With Quote
  #2  
Old 02-29-2012, 04:28 PM
DennisW's Avatar
DennisW DennisW is offline
Junior Contributor
 
Join Date: Mar 2006
Location: Östersund, Sweden
Posts: 268
Default

Hi,

This seems to be a question for the Office forum that covers Word and VBA. I hope one of the administrators can move it to its properly forum.
__________________
Kind regards,
Dennis

.NET & Excel | 2nd edition PED | MVP
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Trying to Find and Compare Pasted Chinese Character
Trying to Find and Compare Pasted Chinese Character
Trying to Find and Compare Pasted Chinese Character Trying to Find and Compare Pasted Chinese Character
Trying to Find and Compare Pasted Chinese Character
Trying to Find and Compare Pasted Chinese Character
Trying to Find and Compare Pasted Chinese Character Trying to Find and Compare Pasted Chinese Character Trying to Find and Compare Pasted Chinese Character Trying to Find and Compare Pasted Chinese Character Trying to Find and Compare Pasted Chinese Character Trying to Find and Compare Pasted Chinese Character Trying to Find and Compare Pasted Chinese Character
Trying to Find and Compare Pasted Chinese Character
Trying to Find and Compare Pasted Chinese Character
 
Trying to Find and Compare Pasted Chinese Character
Trying to Find and Compare Pasted Chinese Character
 
-->