|
-
Jul 21st, 2005, 04:25 AM
#1
Thread Starter
Member
Create dynamic hyperlink
hi
i have a word document which is connected to a database via vba. i am able to extract text from the database and display in on the page.
how do i insert this text from the database into word as a hyperlink?
thanks
-
Jul 21st, 2005, 11:48 AM
#2
Re: Create dynamic hyperlink
You can change this to use variables.
VB Code:
ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:="http://www.vbforums.com", SubAddress:="", ScreenTip:="", TextToDisplay:="vbforums"
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 22nd, 2005, 03:47 AM
#3
Thread Starter
Member
Re: Create dynamic hyperlink
Excellent
I will be trying that out in a bit. Will let you know if it works!
Thanks
-
Jul 22nd, 2005, 04:02 AM
#4
Thread Starter
Member
Re: Create dynamic hyperlink
no i can't get it to work. basically i want the hyperlink to be added to a certain bookmark. the following code i have and it gives an error
ActiveDocument.Hyperlinks.Add Anchor:=SetBookmark "bmEmail", Address:="Mailto:" & strEmail, SubAddress:="", ScreenTip:="", TextToDisplay:="Email"
-
Jul 22nd, 2005, 04:54 AM
#5
Thread Starter
Member
Re: Create dynamic hyperlink
Ok i now have this code which adds the dynamic hyperlink NEXT to the bookmark. How to I insert it INTO the bookmark?
VB Code:
ActiveDocument.Bookmarks("bkEmail").Select
ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:="mailto:" & strEmail, TextToDisplay:=strEmail
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|