![]() |
|
|
|
#1
|
|||
|
|||
|
Hi Designgrrl
You are correct. I'm confusing word cross references with hyperlinks. Doing a search and replace on hyperlinks reproduces the effect you describe. I found two possible ways around this. 1. Show field code rather than field results. the text in the field code gets changed but updating the field produces the unchanged original. However this is not robust as there may be stuff in the field codes which shouldn't be changed. 2. A more laborious search and replace making sure you use each style in turn. Something like Dim myStyle as Style For each myStyle in Activedocument.styles With selection.find If mystyle = activedocument.style(wdstylehyperlink) then 'do nothing else .clearformatting .replace.clearformatting .text=<search text> .replacement.text=<replace text> .format=true .style=mystyle .forward=true .wrap=wdfindcontinue .execute end if next end sub Please note that you have to include the style in the search parameters so you can avoid searching when the style matches 'Hyperlink' Last edited by slaycock; 10-08-2013 at 08:33 AM. Reason: Premature close |
|
#2
|
|||
|
|||
|
Quote:
Yeah, see my post of a minute ago. You're right on track -- it's just that VBA isn't precisely linear. It may not figure out that it has found a hyperlink until after it digs in there. (sigh) |
|
| Tags |
| conditional, replace |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Insert the Hyperlink and hide all sheets except clicking Hyperlink
|
PRADEEPB270 | Excel | 1 | 02-22-2013 09:47 AM |
| Hyperlink/Data Insert & replace | jclinton | Word | 1 | 09-19-2012 07:22 PM |
Macro to replace one specific heading style with another
|
ubns | Word VBA | 44 | 09-04-2012 08:17 PM |
| Find bullets and replace with paragraph style? | cdybdahl | Word | 1 | 12-02-2011 02:14 AM |
| Find and replace multiple documents change style | BaPW | Word | 0 | 08-14-2011 11:12 AM |