Crate a Hyperlink from selected Text

W

William Main

I find that I end up pasting a lot of URLs in to a page as
i am designing it. I then need to select it and convert it
to a link with the insert hyperlink command.

I wrote a simple VBA script to handle this so that all I
have to do is select the url (usually the whole line) then
click a menu item I created which envokes my code.

My code follows:

Option Explicit

Sub CreateLink()
Dim oSelected As IHTMLSelectionObject
Dim oTextRange As IHTMLTxtRange
Dim strLink As String

Set oSelected =
FrontPage.Application.ActiveDocument.Selection
Set oTextRange = oSelected.createRange
strLink = oTextRange.Text
oTextRange.execCommand "CreateLink", False, strLink
End Sub

I also added a menu item under the Help menu to bring up
the Frontpage SDK help file. It follows:

Public Sub FPSDK()
Call Shell("C:\WINDOWS\hh.exe d:\FPSDK\FPSDK.chm",
vbNormalFocus)
End Sub

Both of these should me in a module. Then you can add the
macros to menu items by right clicking on the Menu in FP
and selecting Customize.
 

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