Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 07-03-2024, 05:40 AM
vivka vivka is offline VBA include Character Code 002D Dash-Minus Windows 7 64bit VBA include Character Code 002D Dash-Minus Office 2016
Expert
 
Join Date: Jul 2023
Posts: 294
vivka is on a distinguished road
Default

Shelley Lou, I have two ideas.
Idea 1: try replacing the appropriate part of your code with this:
Code:
Dim sStr As String
          
          Select Case InStr(oRngEval, sStr) = 1
            Case sStr = "-" 'highlights if cross refs seperated by a dash e.g. clause 1-2
              oRng.Move wdCharacter, 1
              lngOffset = 0
            Case sStr = ", " 'highlights if cross refs seperated by a comma e.g. clause 1, 2
               oRng.Move wdCharacter, 2
               lngOffset = 0
            Case sStr = " - " 'highlights if cross refs seperated by a dash and space either side e.g. clause 1 - 2 THIS CURRENTLY DOESN'T WORK
              oRng.Move wdCharacter, 3
              lngOffset = 3
            Case sStr = " or " 'highlights if cross refs seperated by the word 'or' e.g. clause 1 or 2
              oRng.Move wdCharacter, 4
              lngOffset = 4
            Case sStr = " to " 'highlights if cross refs seperated by the word 'to' e.g. clause 1 to 2
              oRng.Move wdCharacter, 4
              lngOffset = 4
            Case sStr = " and " 'highlights if cross refs seperated by the word 'and' e.g. clause 1 and 2
              oRng.Move wdCharacter, 5
              lngOffset = 5
            Case sStr = " and/or " 'highlights if cross refs seperated by the word 'and/or' e.g. clause 1 and/or 2
              oRng.Move wdCharacter, 8
              lngOffset = 8
            Case Else
              bCompound = False
          End Select
Idea 2: Probably, the dash in the text and the dash the code is looking for are actually different dashes (they have different codes), though they look identical.
To find out the dashes' codes, select them and then use AscW(selection).
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA include Character Code 002D Dash-Minus List of ascii code of Character Symbols or code for all symbols used in Word SamDsouza Word VBA 3 03-12-2020 04:49 AM
VBA include Character Code 002D Dash-Minus How can you use the " character for inches in a field code? steveflooks Word 1 07-19-2018 02:52 PM
VBA include Character Code 002D Dash-Minus Help to include header and footer in string search code which i already have. branko Word VBA 1 03-28-2017 11:50 PM
Is it possible to include a newline character in the replace text desgordon Word 2 09-14-2012 02:28 AM
VBA include Character Code 002D Dash-Minus Need Word to change -- (dash,dash) into one long dash. Bobosmite Word 2 05-06-2011 04:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:02 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft