Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Access VBA coding definition

Posted on 2012-09-20
9
Medium Priority
?
558 Views
Last Modified: 2012-10-03
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!
0
Comment
Question by:sarah_siu
  • 5
  • 4
9 Comments
 
LVL 40

Expert Comment

by:als315
ID: 38419279
In VBA editor select sub (function) name and press F1. For shell you will get:
shell
0
 

Author Comment

by:sarah_siu
ID: 38419288
Thanks als315.  As I don't have much experience with VBA, would you mind putting this in layman terms for me?
0
 
LVL 40

Expert Comment

by:als315
ID: 38419321
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:sarah_siu
ID: 38421756
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
 
LVL 40

Expert Comment

by:als315
ID: 38421831
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
 

Author Comment

by:sarah_siu
ID: 38421861
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
 

Author Comment

by:sarah_siu
ID: 38421865
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
 
LVL 40

Accepted Solution

by:
als315 earned 2000 total points
ID: 38422588
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
 

Author Closing Comment

by:sarah_siu
ID: 38460337
Sorry it took so long but thanks a lot for your help!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Starting up a Project
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question