Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Rob
 
Posts: n/a
Default 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   Report Post  
Ed Ferrero
 
Posts: n/a
Default

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   Report Post  
Rob
 
Posts: n/a
Default

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   Report Post  
Bob Phillips
 
Posts: n/a
Default

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   Report Post  
Rob
 
Posts: n/a
Default

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   Report Post  
Bob Phillips
 
Posts: n/a
Default

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   Report Post  
Rob
 
Posts: n/a
Default

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   Report Post  
Bob Phillips
 
Posts: n/a
Default


"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   Report Post  
Rob
 
Posts: n/a
Default

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   Report Post  
Bob Phillips
 
Posts: n/a
Default

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   Report Post  
Rob
 
Posts: n/a
Default

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I can not open my excel program, myriam Excel Discussion (Misc queries) 1 March 18th 05 01:42 PM
can't open 2 excel program a once tim Excel Worksheet Functions 2 February 22nd 05 02:49 AM
When I open excel document it always ask if I want to open it in . dperkins Excel Discussion (Misc queries) 0 February 15th 05 08:11 PM
how do i open Excel program without loading a new worksheet? mElissA Excel Discussion (Misc queries) 4 December 31st 04 01:56 AM
Cannot open a file that Excel says is open Plodhia Excel Discussion (Misc queries) 2 December 7th 04 01:43 AM


All times are GMT +1. The time now is 11:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"