Domino Code Fragment

Code Name*
Open a Freelance Presentation via Automation
Date*
04/29/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.22.171.136
Description*
This routine puts up a common dialog that prompts the user to select a Freelance presentation to open. If the user selects a file then it creates a Freelance automation session and opens the requested doc. It chops up the name returned from the dialog into file name and path parts for the open command. There may be a more standard way to do this but I couldn't find it.
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
Public gFlwDoc As Variant
Public gFlwPage As Variant
Public gFlwApp As Variant

Sub OpenPres
Dim mydlg As LWPCommonDialog
Dim extension As String
Dim Length As Integer
Dim extloc As Long
Dim filename As String
Dim filepath As String
Dim lastLoc As Long
Dim NameLoc As Long


On Error Goto HandleError
Set MyDlg = Bind("")
mydlg.Filter = "Freelance|*.prz"
mydlg.text = "Select a Freelance Presentation to open:"
mydlg.FilterIndex = 1
mydlg.type = 0
mydlg.InitDir = "\lotus\work\flg"
mydlg.Show(0)

length = Len(mydlg.FileName)

If length > 0 Then

gFlwPres = mydlg.FileName

Set gFlwApp = CreateObject("Freelance.Application")
gFlwApp.visible = 1
Activateapp "Lotus Word Pro"
gSeeFree = False
'Chop name into file name and path parts
LastLoc = 0
Do
nameLoc = Instr(LastLoc + 1, mydlg.FileName, "\")

If NameLoc <> 0 Then
LastLoc = nameLoc
End If
Loop Until nameLoc = 0


If LastLoc <> 0 Then
FilePath = Left(gFlwPres,LastLoc - 1)
FileName = Right(gFlwPres,Length - LastLoc)
Else
FilePath = ""
FileName = gFlwPres
End If

Set gFlwDoc = gFlwApp.Opendocument(FileName,FilePath,"")
gHavePres = 1


End If
Goto Success
HandleError:
Messagebox Error$(),MB_ICONEXCLAMATION,"Error Opening Presentation"
gHavePres = 0
Exit Sub
Success:
End Sub