![]() |
#1
|
|||
|
|||
![]()
When using Regular Expression search using VBA script in Excel to search Word document, "-" character in the word document gets skiped (substituted with "" empty character).
Here is the string in Word: <DE4.0><SWR4.4.l‑CE6:A> Here is the snipet of VBA code used: With Selector.Find .text = "\<DE?*^13" .Replacement.text = "" .Forward = True .Wrap = wdFindzz .Format = True .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True End With The search find the string in the Word and here is the resulting string in the VBA: <DE4.0><SWR4.4.lCE6:A> As you can see the "-" hyphen character is missing in the resulting string and I can't understand why and how to fix it. Can someone help me with this? Thanks Alex P.S. I've attached the Word and Excell document that I'm using if someone wants to try it. The VBA macro in Excel that does this work called DEExtract. Put a breakpoint on the line 250 ( While Selector.Find.Execute) and after that Selector.text will show the search result. To execute it, click on the "Import Design Elements" on the Design Elements tab and then select the word document. |
![]() |
Tags |
excel formatting, regular expression, word 2007 |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
loes | Word | 3 | 09-04-2019 07:52 AM |
Regular expressions and field codes | Cosmo | Word VBA | 5 | 04-20-2018 04:10 PM |
Word Regular Expressions: zero or more occurences? | tinfanide | Word | 6 | 09-16-2015 03:13 PM |
regular expressions for empty lines | eNGiNe | Word | 1 | 01-21-2013 06:38 AM |
![]() |
tinfanide | Excel Programming | 4 | 05-30-2012 04:09 AM |