Visual Basic to open software (1 Viewer)

kevnaff

Member
Local time
Today, 17:00
Joined
Mar 25, 2021
Messages
141
Hi All.

I have taken over a database which the code was written for many years ago.

One of the forms contains 2 buttons that open a .exe file. One button opens the .exe that is stored on the user's home drive, and the other opens the .exe that is stored on their C: Drive. Around 4 weeks ago, the buttons stopped working for some users, and have slowly started to affect everybody. I imagine that some updates performed by our IT Department have caused this issue. I have had a similar issue in the past when they have issued a new version of Adobe's PDF Reader, and the .exe file name has changed. However the file location or name have definitely not changed.

When opening the home drive .exe I get the following error:

The expression On Click you entered as the event property setting produced the following error: Invalid procedure call or argument



The code that is behind the home drive button is:

Rem On Error GoTo Err_CommandQA90Home_Click



Dim stAppName As String

Dim stHomepath As String



stHomepath = CurDir





Rem stAppName = stHomepath & "\QA90PRO32\Qa90pro.exe"

stAppName = "H:\QA90PRO32\Qa90pro.exe"

Call Shell(stAppName, 1)



Exit_CommandQA90Home_Click:

Exit Sub



Err_CommandQA90Home_Click:

MsgBox Err.Description

Resume Exit_CommandQA90Home_Click


Does anybody have any tips as to why these errors may be occurring?

Thanks
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 01:00
Joined
May 7, 2009
Messages
19,169
maybe there is an error so re-instate the error handler by removing the "rem" from this:

Rem On Error GoTo Err_CommandQA90Home_Click

you can also check if the .exe will work.
on Immediate window you can Shell:

Shell "H:\QA90PRO32\Qa90pro.exe"
 

kevnaff

Member
Local time
Today, 17:00
Joined
Mar 25, 2021
Messages
141
maybe there is an error so re-instate the error handler by removing the "rem" from this:

Rem On Error GoTo Err_CommandQA90Home_Click

you can also check if the .exe will work.
on Immediate window you can Shell:

Shell "H:\QA90PRO32\Qa90pro.exe"
Hi arnelgp.

I have removed the rem and get the following:

1623066973773.png


When I enter Shell "H:\QA90PRO32\Qa90pro.exe" in to the Immediate Window, I get the following:

1623067090205.png


Hope this makes sense, thanks for your reply.
 

Gasman

Enthusiastic Amateur
Local time
Today, 17:00
Joined
Sep 21, 2011
Messages
14,044
Please show a pic of the file location showing ALL of the path
Can you shell to any other exe?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 01:00
Joined
May 7, 2009
Messages
19,169
that is already a clue, so can you go to that folder and dir the .exe?
 

Gasman

Enthusiastic Amateur
Local time
Today, 17:00
Joined
Sep 21, 2011
Messages
14,044
that is already a clue, so can you go to that folder and dir the .exe?
I get a file not found message if I change to a non existent filename?
 

kevnaff

Member
Local time
Today, 17:00
Joined
Mar 25, 2021
Messages
141
Please show a pic of the file location showing ALL of the path
Can you shell to any other exe?

Hi Gasman,

This is the location of the file. The file path within the properties is H:\QA90PRO32\QA90pro.exe

1623067966723.png



I have changed the code behind the button to include the following .exe file

stAppName = "H:\Visi Download Backup\Visi-Download\Visi-Download.exe"
Call Shell(stAppName, 1)

When click on the button now I get the below error


1623068114974.png



When clicking on debug, it brings up the following:

1623068209877.png
 

Gasman

Enthusiastic Amateur
Local time
Today, 17:00
Joined
Sep 21, 2011
Messages
14,044
Looks like something wrong with your Shell then?
You do not have your own sub/function called Shell do you?

The Shell, with or without Call works fine for me. However I do not use that second parameter?

I would not go changing the code, you can test all this in the immediate window.? which is what I am doing.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 01:00
Joined
May 7, 2009
Messages
19,169
what is the full path of mapped drive H:?
it can't be on onedrive or dropbox, etc.
 

kevnaff

Member
Local time
Today, 17:00
Joined
Mar 25, 2021
Messages
141
that is already a clue, so can you go to that folder and dir the .exe?
Hi Arnel,

I'm not sure what you mean by dir the .exe

There are 8 people who use the button within the department. It currently works for 2 members of staff, but not for the other 6.

This makes me think that it is something to do with our IT team, and some users having installed new updates.
 

kevnaff

Member
Local time
Today, 17:00
Joined
Mar 25, 2021
Messages
141
It could be that some updates are blocking Shell - see https://techcommunity.microsoft.com...ll-function-does-not-work-anymore/m-p/1605266
What do you get if you try this:
Code:
stAppName = "H:\QA90PRO32\Qa90pro.exe"

'Call Shell(stAppName, 1)
Application.FollowHyperlink stAppName
Cheers,
Hi bastanu,

I tried what you said and initially nothing happened, then after around 30 seconds or so the following popped up:

1623156525778.png



When I click OK I get the following:

1623156672256.png




Also. I have just been working from an MDE on a PC that I don't normally use. The MDE also uses the call shell function very heavily. It was working completely fine, up until my lunch break, when I was asked by my PC to install the latest updates. I updated the PC, opened up the MDE and then went to open up a .exe via a button and was given the same Invalid procedure call or argument message. This almost all but confirms that the issue is the latest update, which had already been installed on my regular PC. It has updated this PC to the following OS version:

1623157013666.png


Another member of staff's computer whose call shell function is working completely fine is on this version:

1623158881693.png
 

Users who are viewing this thread

Top Bottom