passing values to a function

  • Thread starter Thread starter Bre-x
  • Start date Start date
B

Bre-x

Hi, I have this function :

Public Function open_app()
Call Shell("msaccess.exe ""M:\INV\Inv_JEFF.mdb""", 1)
DoCmd.Quit
End Function

I would like to pass a value ( the path of the mdb)

Something like:

Public Function open_app(the_path as String)

Call Shell("msaccess.exe" the_path,1)

Thank you all

Bre-x
 
Public Function open_app(the_path as String)

Call Shell("msaccess.exe """ & the_path & """",1)

End Function

That's three double quotes after msaccess.exe, and four double quotes after
the_path.
 
Thank you, it works!!


Public Function open_app(theapp As String, thepath As String)
On Error GoTo Err_open_app
Dim ie As Object

Select Case theapp
Case "MSACCESS"
Call Shell("msaccess.exe """ & thepath & """", 1)
DoCmd.Quit
Case "MSEXCEL"
Call Shell("excel.exe """ & thepath & """", 1)
DoCmd.Quit
Case "MSWORD"
Call Shell("word.exe """ & thepath & """", 1)
DoCmd.Quit
Case "IE"
Set ie = CreateObject("InternetExplorer.Application")
ie.AddressBar = False
ie.MenuBar = True
ie.Toolbar = True
ie.Width = 1024
ie.Height = 768
ie.Left = 0
ie.Top = 0
ie.navigate thepath
ie.resizable = True
ie.Visible = True
Set ie = Nothing
DoCmd.Quit
Case Else
Responce = MsgBox("Application Error.", vbCritical, " UMCORP")
Exit Function
End Select
Exit_open_app:
Exit Function
Err_open_app:
MsgBox Err.Description
Resume Exit_open_app
End Function
 
Back
Top