Approach User Support homepage Approach User Support
Answers to Frequently Asked Questions about Lotus Approach
Examples LotusScripts
Example databases
Links to other Lotus Approach support services

[Return to contents]

Example LotusScript: A button activated script that launches URL contained in a text field

Last updated: 12 Jul 2002

(Contributed by "Paul Bent" <>)

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 Public
Option Explicit
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
  'Non-specific handler
  Msgbox "Error " & Format$(Err, "#0") & _
  " - message: " & Error$, 16, "System Error"
  Resume ExitSub
End Sub

6. Press F2 and OK the no errors msg, press Shift + F2, ditto. Save the apr then test.

[Return to contents]

© Copyright, JohnBrown, Trademarks, Disclaimer, Acknowledgements.