Welcome to Egypt Forums Mark forums read | Egypt Main Page
Egypt Forums
Arabic Movies



Programming Languages A Place for windows applications programs and programmers .

Programming Languages Thread, Creating dynamic hyperlinks in Word - embedding fields inside fields using VB in Programming , WebDesign & Development; I am trying to create links to specific locations with each document between two documents. The document names will change. ...

Short Link: http://forum.egypt.com/enforum/showthread.php?t=13808


Reply
LinkBack Thread Tools Display Modes
Creating dynamic hyperlinks in Word - embedding fields inside fields using VB
 
 
Senior Member

Reply With Quote
 
Join Date: Dec 2008
Posts: 18,122
07-01-2009, 11:01 PM
 
I am trying to create links to specific locations with each document between two documents. The document names will change. I can update the current name of the other document by creating a custom property called "otherDoc". I have solved most...

I am trying to create links to specific locations with each document between two documents. The document names will change. I can update the current name of the other document by creating a custom property called "otherDoc". I have solved most problems, however, I am unable to insert a field into the address of the link (to make the link dynamic) without utilizing the showfieldcodes command (which is very memory and time consuming since the documents I am working on are very large). Below is my code. I was wondering if there is any way to set the address as a field? Or somehow input an address and it would be understood by word to be field.


Sub link_to_other()

'pastes hyperlink to the other document
Selection.PasteSpecial Link:=True, DataType:=wdPasteHyperlink, Placement:= _
wdInLine, DisplayAsIcon:=False

'selects the hyperlink that was just inserted
Set myField = Selection.PreviousField

'creates variables
Dim temp_address As String
Dim temp_subaddress As String

'sets variables
temp_address = ActiveDocument.CustomDocumentProperties("otherDoc" ).Value & ".doc"
temp_subaddress = Selection.Range.Hyperlinks(1).SubAddress

'changes the hyperlink the the dynamic value
Set SCut = ActiveDocument.Hyperlinks.Add( _
Anchor:=Selection.Range, _
Address:=temp_address, SubAddress:=temp_subaddress)
End Sub
 
 
 
Reply

Programming Languages Thread, Creating dynamic hyperlinks in Word - embedding fields inside fields using VB in Programming , WebDesign & Development; I am trying to create links to specific locations with each document between two documents. The document names will change. ...

Short Link: http://forum.egypt.com/enforum/showthread.php?t=13808


Bookmarks

Tags
creating, dynamic, embedding, fields, hyperlinks, inside, word


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump