CodeDocu.com

Word macro: Automatic correction of wrong translation links

 

Subject: Word document translations with links to the address https://ssl.translatoruser.net/bv.aspx?

 

If you translate Word documents with Microsoft Word translator into another language, then the links in the document be transferred Translatoruser.NET to link to the address.

With a macro, you can automatically correct the links provided both versions (the English translation and the German original) are still in the entire Word document.

 

 

www.Rue25.de

http://www.Microsoft-programmierer.de  

 

Word macro: Automatic correction of wrong translation links

 

 

Here the complete macro, which exchanges the defective links with the original links

Word macro:

Sub change_Links()
'-----------------< change_Links() >-----------------
Dim link_Trans As Hyperlink
 
Dim iLink As Integer
For iLink = 1 To ActiveDocument.Hyperlinks.Count
'< get wrong >
Set link_Trans = ActiveDocument.Hyperlinks(iLink)
'</ get wrong >

'Address : "https://ssl.translatoruser.net/bv.aspx?from=de&to=en&a=http%3A%2F%2Fwww.rue25.de%2F" : String : ThisDocument.change_Links
If link_Trans.Address Like "*translatoruser.*" Then
'----< Change Translatoruser >----
Dim sLink_Text As String
sLink_Text = link_Trans.TextToDisplay
 
 
'< search rightLink >
Dim iSearch As Integer
'----< @Loop: Good Links >----
For iSearch = 1 To ActiveDocument.Hyperlinks.Count
Dim link As Hyperlink
Set link = ActiveDocument.Hyperlinks(iSearch)
If LCase(link.TextToDisplay) = LCase(link_Trans.TextToDisplay) Then
If Not link.Address Like "*translatoruser.*" Then
'< change link >
link_Trans.Address = link.Address
'</ change link >
End If
End If
Next
'----</ @Loop: Good Links >----
'</ search rightLink >
 
'----</ Change Translatoruser >----
End If
Next
'-----------------</ change_Links() >-----------------
End Sub

 

 

 
 


Software Entwicklung Stuttgart NĂ¼rtingen
Suche Projekte C#, WPF, Windows App,ASP.Net, vb.Net, WinForms, SQL Server, Access, Excel