Change Word Links via VBA ?

M

Mario Reiley

Hello Group,

I have a document in Word with Bonds to Excel. I need to change statements I
link using VBA.

For example:

My old Source Path
"C:\Source Project\My file.doc"

My New Source Path

and I want to change a part to
"C:\New Project\My file.doc"

Any advisor will be Wellcome

Best Regard
Mario
 
J

Jean-Guy Marcil

Mario Reiley was telling us:
Mario Reiley nous racontait que :
Hello Group,

I have a document in Word with Bonds to Excel. I need to change
statements I link using VBA.

For example:

My old Source Path
"C:\Source Project\My file.doc"

My New Source Path

and I want to change a part to
"C:\New Project\My file.doc"

Display all field codes, then find/replace all "C:\Source Project\" with
"C:\New Project\".


'_______________________________________
Application.ScreenUpdating = False

ActiveWindow.View.ShowFieldCodes = True

With Selection
.Find.ClearFormatting
.Find.Replacement.ClearFormatting
With .Find
.Text = "TIME"
.Replacement.Text = "DATE"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
.Find.Execute Replace:=wdReplaceAll
End With

ActiveWindow.View.ShowFieldCodes = False

Application.ScreenUpdating = True
Application.ScreenRefresh
'_______________________________________

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top