[Return to contents]
Last updated: 12 Jul 2002
(Contributed by "Paul Bent" <email@example.com>)
1. Select the button. On the macros tab of the Info Box, give it a
meaningful object name like btnGoToURL.
2. Open the script editor (Ctrl + K)
3. Select Global in Object list, select Options in the Scripts list. Enter these statements in the script pane: (Option Public is probably there already)
Option Compare Nocase
4. Expand the Object list. Click the green twisty by the name of the apr to expand its object collection one level. Locate the name of the view
containing the button and click the twisty to expand it. Expand the Body
object, locate the name of the button and select it.
5. With the button selected in the Object list, select Click in the Scripts list. Paste this code into the scripts pane so the end result looks like:
Sub Click(Source As Button, X As Long, Y As Long, Flags As Long)
'--- Opens the default browser and goes to the ' url contained in the URL field of the current record Dim intRtn As Integer 'Function return value On Error Goto ErrTrap intRtn = Shell("rundll32.exe url.dll,FileProtocolHandler http://" _ & CurrentView.Body.fbxURL.Text) Goto ExitSub ErrTrap: 'Non-specific handler Msgbox "Error " & Format$(Err, "#0") & _ " - message: " & Error$, 16, "System Error" Resume ExitSub ExitSub: End Sub
6. Press F2 and OK the no errors msg, press Shift + F2, ditto. Save the apr then test.