Access VBA coding definition

Hi Everyone,

I have this piece of code and was wondering what it means.  Especially, what does "Call Shell(stAppName, 1) mean?  


Private Sub Assigned_To_Click()
On Error GoTo Err_Assigned_To_Click

    Dim stAppName As String

    stAppName = "a"
    Call Shell(stAppName, 1)

Exit_Assigned_To_Click:
    Exit Sub

Err_Assigned_To_Click:
    MsgBox Err.Description
    Resume Exit_Assigned_To_Click
   
End Sub

Your help is greatly appreciated!
sarah_siuAsked:
Who is Participating?
 
als315Commented:
You should try to find in your computer file a.exe. It should be in default folders, which you can find if open command prompt (cmd) and type: path
You should see:
PATH=C:\Windows\system32;C:\Windows;........
You can type a there and a.exe will start if it exists.
0
 
als315Commented:
In VBA editor select sub (function) name and press F1. For shell you will get:
shell
0
 
sarah_siuAuthor Commented:
Thanks als315.  As I don't have much experience with VBA, would you mind putting this in layman terms for me?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
als315Commented:
With shell you can start any application. For example, notepad:

Call Shell("notepad", vbMaximizedFocus)

In you example application name is "a", so you should have a.exe in any default path.
0
 
sarah_siuAuthor Commented:
I tried to find out what "a" is and from what I see, it seems that "a" is a string as per these two lines :

 Dim stAppName As String

    stAppName = "a"

Am I reading it wrong?
0
 
als315Commented:
stAppName is vaiable assigned to string "a". In shell call stAppName is used, but you can change all code to one string:
Call Shell("a", 1)
Other strings (at the end of sub) are error handling
0
 
sarah_siuAuthor Commented:
So the first part of the code

On Error GoTo Err_Assigned_To_Click

    Dim stAppName As String

    stAppName = "a"
    Call Shell(stAppName, 1)

Exit_Assigned_To_Click:
    Exit Sub

I am calling an application of some sort named "a" is that correct?
0
 
sarah_siuAuthor Commented:
If that is correct, do you have any idea how I may find a...I'm trying to read someone else's code and am having a very difficult time...
0
 
sarah_siuAuthor Commented:
Sorry it took so long but thanks a lot for your help!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.