Because most of the code resides in the function, there is less chance for logic and syntax errors because you’re not rewriting the same code over and over. It also makes your application smaller, because less code exists in the application.

Private Sub Command1_Click()
Dim strApp As String
Dim blnResult As Boolean
strApp = InputBox("Enter Application Name")
blnResult = OpenApp(strApp)
MsgBox blnResult & " result opening " & strApp
End Sub
Function OpenApp(strApp As String) As Boolean
On Error Resume Next
Shell strApp
Select Case Err.Number
Case 0:
OpenApp = True
Case Else:
OpenApp = False
End Select
End Function