Using a comand button to open an external software? [Solved/Closed]

Report
Posts
10
Registration date
Thursday September 17, 2015
Status
Member
Last seen
September 30, 2015
-
Posts
10
Registration date
Thursday September 17, 2015
Status
Member
Last seen
September 30, 2015
-
Hello.

I'm using Excel and I need do create a comand button to open an external software, e.g. I need do order that button to open "Profis Anchor from Hilti". I already tried to google this question but I only find informations about how to open documents, etc.

Does anyone know how can I do this?
I really need this, I appreciate any help that anyone could give me.

1 reply

Posts
47712
Registration date
Monday February 1, 2010
Status
Moderator
Last seen
October 22, 2020
9,675
1
Thank you

A few words of thanks would be greatly appreciated. Add comment

CCM 2942 users have said thank you to us this month

Posts
47712
Registration date
Monday February 1, 2010
Status
Moderator
Last seen
October 22, 2020
9,675 >
Posts
10
Registration date
Thursday September 17, 2015
Status
Member
Last seen
September 30, 2015

Good luck and let us know.
Posts
122
Registration date
Tuesday August 31, 2010
Status
Contributor
Last seen
June 20, 2016
24
Once you have created the button: Point it to this macro.

In this example it will open Notepad.
You will need to supply the full path of the program you want to open in the Path string. e..g "c:\myprogram\exec\Profis Anchor from Hilti.exe" or whatever the software is you are trying to open.


Sub OpenExternalProgram()
    Dim x As Variant
    Dim Path As String

    ' Set the Path variable equal to the path of your program's installation
    Path = "notepad"

    x = Shell(Path, vbNormalFocus)
End Sub
Posts
10
Registration date
Thursday September 17, 2015
Status
Member
Last seen
September 30, 2015
>
Posts
122
Registration date
Tuesday August 31, 2010
Status
Contributor
Last seen
June 20, 2016

Hello, first of all thank you for your help and i'm sorry for only reply today.

I tried the code above and I've 2 doubts:
1) when you say I need to suply the full path are you saying that I need to put:
path="c:\myprogram\exec\Profis Anchor from Hilti.exe" e.g

2)and when I run the macro it stops when I say that x="shell(path, vbNomralFocus)

What can I am doing wrong?

Thanks for your help.
Posts
122
Registration date
Tuesday August 31, 2010
Status
Contributor
Last seen
June 20, 2016
24 >
Posts
10
Registration date
Thursday September 17, 2015
Status
Member
Last seen
September 30, 2015

1. Yes. You need to enter the folder location and the executable of the program you are trying to open. As another example for you:
C:\Program Files\Microsoft Office\Office14\WINDORD.EXE
Setting the path with the above value will point to Word (on my PC, yours may be different)
I don't know where the software you are trying to open is installed or what the executable is called so I cannot give you the exact value.
2. This is most likely happening (a guess since you don't give an error) that the path setting is incorrect.
Posts
10
Registration date
Thursday September 17, 2015
Status
Member
Last seen
September 30, 2015
>
Posts
122
Registration date
Tuesday August 31, 2010
Status
Contributor
Last seen
June 20, 2016

Today I tried again and it works perfeclty. Yesterday I had somekind of a bug, I dont know.

Thanks a lot for your help.