Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Open another program sing VBA
Hi all,
I would like to open another program, (MYOB), by clicking its picture that I've pasted to a worksheet. I know how to assign a macro to the picture but I'm having difficulties in writing the macro to execute the MYOB program. Rob |
#2
|
|||
|
|||
Hi Rob,
Right-click the picture and assign a hyperlink to it. Ed Ferrero "Rob" <NA wrote in message ... Hi all, I would like to open another program, (MYOB), by clicking its picture that I've pasted to a worksheet. I know how to assign a macro to the picture but I'm having difficulties in writing the macro to execute the MYOB program. Rob |
#3
|
|||
|
|||
Thanks for your quick response, Ed. That certainly works great, but I also
want a little bit of control over this procedure, eg if the program is already open then I don't want the hyperlink to work. And also another example, where I want to have the option to proceed with the hyperlink or not depenfding on certain circumstances. In other words I would rather use VBA to go to open another program so that I can have control over when that program might be opened. Can you help with that? Rob "Ed Ferrero" wrote in message ... Hi Rob, Right-click the picture and assign a hyperlink to it. Ed Ferrero "Rob" <NA wrote in message ... Hi all, I would like to open another program, (MYOB), by clicking its picture that I've pasted to a worksheet. I know how to assign a macro to the picture but I'm having difficulties in writing the macro to execute the MYOB program. Rob |
#4
|
|||
|
|||
What do you mean by a program, as you run a procedure, not open it? Do you
mean open another workbook? -- HTH RP (remove nothere from the email address if mailing direct) "Rob" <NA wrote in message ... Thanks for your quick response, Ed. That certainly works great, but I also want a little bit of control over this procedure, eg if the program is already open then I don't want the hyperlink to work. And also another example, where I want to have the option to proceed with the hyperlink or not depenfding on certain circumstances. In other words I would rather use VBA to go to open another program so that I can have control over when that program might be opened. Can you help with that? Rob "Ed Ferrero" wrote in message ... Hi Rob, Right-click the picture and assign a hyperlink to it. Ed Ferrero "Rob" <NA wrote in message ... Hi all, I would like to open another program, (MYOB), by clicking its picture that I've pasted to a worksheet. I know how to assign a macro to the picture but I'm having difficulties in writing the macro to execute the MYOB program. Rob |
#5
|
|||
|
|||
As per my first posting, I'm trying to open a program called MYOB (an
accounting program), not another workbook. (It's not a microsoft pgm.) Basically put... I need some code that will start up that MYOB program and the related file. The reason I want this as code is that a hyperlink can open up more than one instance of a program which I want to prevent and, I also want to do some other stuff before the code executes the opening of the MYOB program. The full path to the MYOB program file is: K:\0000\MYOB\Data\xxx.prm (I've looked through help, etc., but cannot seem to locate any instruction on how to open a program other than a microsoft program.) Rob "Bob Phillips" wrote in message ... What do you mean by a program, as you run a procedure, not open it? Do you mean open another workbook? -- HTH RP (remove nothere from the email address if mailing direct) "Rob" <NA wrote in message ... Thanks for your quick response, Ed. That certainly works great, but I also want a little bit of control over this procedure, eg if the program is already open then I don't want the hyperlink to work. And also another example, where I want to have the option to proceed with the hyperlink or not depenfding on certain circumstances. In other words I would rather use VBA to go to open another program so that I can have control over when that program might be opened. Can you help with that? Rob "Ed Ferrero" wrote in message ... Hi Rob, Right-click the picture and assign a hyperlink to it. Ed Ferrero "Rob" <NA wrote in message ... Hi all, I would like to open another program, (MYOB), by clicking its picture that I've pasted to a worksheet. I know how to assign a macro to the picture but I'm having difficulties in writing the macro to execute the MYOB program. Rob |
#6
|
|||
|
|||
Shell it. Look up shell in VBA help.
-- HTH RP (remove nothere from the email address if mailing direct) "Rob" <NA wrote in message ... As per my first posting, I'm trying to open a program called MYOB (an accounting program), not another workbook. (It's not a microsoft pgm.) Basically put... I need some code that will start up that MYOB program and the related file. The reason I want this as code is that a hyperlink can open up more than one instance of a program which I want to prevent and, I also want to do some other stuff before the code executes the opening of the MYOB program. The full path to the MYOB program file is: K:\0000\MYOB\Data\xxx.prm (I've looked through help, etc., but cannot seem to locate any instruction on how to open a program other than a microsoft program.) Rob "Bob Phillips" wrote in message ... What do you mean by a program, as you run a procedure, not open it? Do you mean open another workbook? -- HTH RP (remove nothere from the email address if mailing direct) "Rob" <NA wrote in message ... Thanks for your quick response, Ed. That certainly works great, but I also want a little bit of control over this procedure, eg if the program is already open then I don't want the hyperlink to work. And also another example, where I want to have the option to proceed with the hyperlink or not depenfding on certain circumstances. In other words I would rather use VBA to go to open another program so that I can have control over when that program might be opened. Can you help with that? Rob "Ed Ferrero" wrote in message ... Hi Rob, Right-click the picture and assign a hyperlink to it. Ed Ferrero "Rob" <NA wrote in message ... Hi all, I would like to open another program, (MYOB), by clicking its picture that I've pasted to a worksheet. I know how to assign a macro to the picture but I'm having difficulties in writing the macro to execute the MYOB program. Rob |
#7
|
|||
|
|||
Thanks Bob,
From the help I was able to run the following.... Sub OpenMYOB() Dim ReturnValue MyAppID = Shell("D:\Program Files\Myob Premier Trial\Myobp.exe", 1) AppActivate MyAppID 'Activate MYOB End Sub (although I don't understand why ReturnValue is dimmed.) However, even though this starts the MYOB program OK I would like the actual MYOB data file to open with it, (just as you would when you click an Excel file which Opens Excel and then displays the Excel file as well.) Can you help with that or point me in the right direction? (As I said previously the path to the MYOB file I wish to open is K:\0000\MYOB\Data\xxx.prm) Thanks so far! Rob "Bob Phillips" wrote in message ... Shell it. Look up shell in VBA help. -- HTH RP (remove nothere from the email address if mailing direct) "Rob" <NA wrote in message ... As per my first posting, I'm trying to open a program called MYOB (an accounting program), not another workbook. (It's not a microsoft pgm.) Basically put... I need some code that will start up that MYOB program and the related file. The reason I want this as code is that a hyperlink can open up more than one instance of a program which I want to prevent and, I also want to do some other stuff before the code executes the opening of the MYOB program. The full path to the MYOB program file is: K:\0000\MYOB\Data\xxx.prm (I've looked through help, etc., but cannot seem to locate any instruction on how to open a program other than a microsoft program.) Rob "Bob Phillips" wrote in message ... What do you mean by a program, as you run a procedure, not open it? Do you mean open another workbook? -- HTH RP (remove nothere from the email address if mailing direct) "Rob" <NA wrote in message ... Thanks for your quick response, Ed. That certainly works great, but I also want a little bit of control over this procedure, eg if the program is already open then I don't want the hyperlink to work. And also another example, where I want to have the option to proceed with the hyperlink or not depenfding on certain circumstances. In other words I would rather use VBA to go to open another program so that I can have control over when that program might be opened. Can you help with that? Rob "Ed Ferrero" wrote in message ... Hi Rob, Right-click the picture and assign a hyperlink to it. Ed Ferrero "Rob" <NA wrote in message ... Hi all, I would like to open another program, (MYOB), by clicking its picture that I've pasted to a worksheet. I know how to assign a macro to the picture but I'm having difficulties in writing the macro to execute the MYOB program. Rob |
#8
|
|||
|
|||
"Rob" <NA wrote in message ... Sub OpenMYOB() Dim ReturnValue MyAppID = Shell("D:\Program Files\Myob Premier Trial\Myobp.exe", 1) AppActivate MyAppID 'Activate MYOB End Sub (although I don't understand why ReturnValue is dimmed.) In my help, it sets the RetVal to the result of the shell operation, to check success or not. However, even though this starts the MYOB program OK I would like the actual MYOB data file to open with it, (just as you would when you click an Excel file which Opens Excel and then displays the Excel file as well.) You can do that by passing the file as an argument to the executable, like this with Notepad Shell "notepad.exe c:\mytest\code.txt", 1 So I guess yours would be MyAppID = Shell("D:\Program Files\Myob Premier Trial\Myobp.exe D:\myfiles\myfile.myp", 1) or something similar |
#9
|
|||
|
|||
Thanks again Bob, but I'm not getting anywhere with this.
I only get the program to load, and not the data file with it. What I've tried is: Shell "D:\Program Files\Myob Premier Trial\Myobp.exe D:\FOLA\Myob\FOLA Feb 05.prm", 1 MyAppID = Shell("D:\Program Files\Myob Premier Trial\Myobp.exe D:\FOLA\Myob\FOLA Feb 05.prm", 1) I can't think of another way to do this. Any ideas? If it can't be done, I can live with that as I'm fairly happy that it at least runs the MYOB program. Also, could you suggest a way to test to see if the MYOB prgm is already running, and if so, to exit the sub? Rob "Bob Phillips" wrote in message ... "Rob" <NA wrote in message ... Sub OpenMYOB() Dim ReturnValue MyAppID = Shell("D:\Program Files\Myob Premier Trial\Myobp.exe", 1) AppActivate MyAppID 'Activate MYOB End Sub (although I don't understand why ReturnValue is dimmed.) In my help, it sets the RetVal to the result of the shell operation, to check success or not. However, even though this starts the MYOB program OK I would like the actual MYOB data file to open with it, (just as you would when you click an Excel file which Opens Excel and then displays the Excel file as well.) You can do that by passing the file as an argument to the executable, like this with Notepad Shell "notepad.exe c:\mytest\code.txt", 1 So I guess yours would be MyAppID = Shell("D:\Program Files\Myob Premier Trial\Myobp.exe D:\myfiles\myfile.myp", 1) or something similar |
#10
|
|||
|
|||
Hi Rob,
Most (but not all) programs allow you to specify a file to open on the command line, but not all. If they do that shell technique should work. Unfortunately, I don't have that app to test myself. -- HTH RP (remove nothere from the email address if mailing direct) "Rob" <NA wrote in message ... Thanks again Bob, but I'm not getting anywhere with this. I only get the program to load, and not the data file with it. What I've tried is: Shell "D:\Program Files\Myob Premier Trial\Myobp.exe D:\FOLA\Myob\FOLA Feb 05.prm", 1 MyAppID = Shell("D:\Program Files\Myob Premier Trial\Myobp.exe D:\FOLA\Myob\FOLA Feb 05.prm", 1) I can't think of another way to do this. Any ideas? If it can't be done, I can live with that as I'm fairly happy that it at least runs the MYOB program. Also, could you suggest a way to test to see if the MYOB prgm is already running, and if so, to exit the sub? Rob "Bob Phillips" wrote in message ... "Rob" <NA wrote in message ... Sub OpenMYOB() Dim ReturnValue MyAppID = Shell("D:\Program Files\Myob Premier Trial\Myobp.exe", 1) AppActivate MyAppID 'Activate MYOB End Sub (although I don't understand why ReturnValue is dimmed.) In my help, it sets the RetVal to the result of the shell operation, to check success or not. However, even though this starts the MYOB program OK I would like the actual MYOB data file to open with it, (just as you would when you click an Excel file which Opens Excel and then displays the Excel file as well.) You can do that by passing the file as an argument to the executable, like this with Notepad Shell "notepad.exe c:\mytest\code.txt", 1 So I guess yours would be MyAppID = Shell("D:\Program Files\Myob Premier Trial\Myobp.exe D:\myfiles\myfile.myp", 1) or something similar |
#11
|
|||
|
|||
Thanks foryour input Bob!
Rob "Bob Phillips" wrote in message ... Hi Rob, Most (but not all) programs allow you to specify a file to open on the command line, but not all. If they do that shell technique should work. Unfortunately, I don't have that app to test myself. -- HTH RP (remove nothere from the email address if mailing direct) "Rob" <NA wrote in message ... Thanks again Bob, but I'm not getting anywhere with this. I only get the program to load, and not the data file with it. What I've tried is: Shell "D:\Program Files\Myob Premier Trial\Myobp.exe D:\FOLA\Myob\FOLA Feb 05.prm", 1 MyAppID = Shell("D:\Program Files\Myob Premier Trial\Myobp.exe D:\FOLA\Myob\FOLA Feb 05.prm", 1) I can't think of another way to do this. Any ideas? If it can't be done, I can live with that as I'm fairly happy that it at least runs the MYOB program. Also, could you suggest a way to test to see if the MYOB prgm is already running, and if so, to exit the sub? Rob "Bob Phillips" wrote in message ... "Rob" <NA wrote in message ... Sub OpenMYOB() Dim ReturnValue MyAppID = Shell("D:\Program Files\Myob Premier Trial\Myobp.exe", 1) AppActivate MyAppID 'Activate MYOB End Sub (although I don't understand why ReturnValue is dimmed.) In my help, it sets the RetVal to the result of the shell operation, to check success or not. However, even though this starts the MYOB program OK I would like the actual MYOB data file to open with it, (just as you would when you click an Excel file which Opens Excel and then displays the Excel file as well.) You can do that by passing the file as an argument to the executable, like this with Notepad Shell "notepad.exe c:\mytest\code.txt", 1 So I guess yours would be MyAppID = Shell("D:\Program Files\Myob Premier Trial\Myobp.exe D:\myfiles\myfile.myp", 1) or something similar |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
I can not open my excel program, | Excel Discussion (Misc queries) | |||
can't open 2 excel program a once | Excel Worksheet Functions | |||
When I open excel document it always ask if I want to open it in . | Excel Discussion (Misc queries) | |||
how do i open Excel program without loading a new worksheet? | Excel Discussion (Misc queries) | |||
Cannot open a file that Excel says is open | Excel Discussion (Misc queries) |