Re: Dim RetVal




Jay

got the same message as in Word "failed to open COED dictionary file"

Margaret

"Jay Freedman" <jay.freedman@xxxxxxxxxxx> wrote in message news:7vg7c51o8m916u1hbia9nme9dim0q4l4p9@xxxxxxxxxx
Sorry, my brain is on vacation today... Please try using the command
window (Start > Run > cmd) again, but put the double quotes around the
command:

"c:\program files\COED11\coed11.exe"

The reason is that without the quotes, the command processor sees the
part up to the first space -- that is, c:\program -- as the command
you're trying to run, and ignores the rest of it. Of course, there is
nothing on your drive whose name is c:\program, so it gives up. (I
mentioned before that computers never try to guess...)

If that starts the program but you get the message about not being
able to open the dictionary, the next thing to try is to "change
directory" to start the program in that location, the way the shortcut
does. That ought to let it find the dictionary file in the same
folder. In the command window, first type

cd "c:\program files\COED11"

and press Enter. (The 'cd' is the 'change directory' command.) You
should see this:

c:\program files\COED11>

Now type

coed11.exe

and press Enter. What happens?


On Wed, 30 Sep 2009 19:37:03 +0100, "Margaret Upton"
<margaretupton@xxxxxxxxxxxxxx> wrote:

Hi Jay

Me again !! answers to your questions.

In the start in it says c:\program files\COED11"

The dropdown is set to normal.

When I type the command as you asked it says - The program is not recognized
as an internal or external command, cooperable program or batch file.

You really are being very kind with all of this, thank you.

Margaret


"Jay Freedman" <jay.freedman@xxxxxxxxxxx> wrote in message
news:6rb5c5d6upen9m4qmkjr7vro38vlhgm1kt@xxxxxxxxxx
I think we're actually making progress, such as it is. The message
about failing to open the dictionary is coming from the coed11.exe
program, not from Word, so that means the macro is running the
program. That's one step better than not running the program. :)

I suspect that the Properties dialog of the desktop icon for the
dictionary program has an entry in the "Start in" box. Is that
correct? If so, what's that entry?

While you're there, is there a dropdown with choices of "Normal
window", "Minimized", and "Maximized"? Make sure it's set to "Normal
window". That ought to fix the problem of it starting minimized.

Also, do you know the folder and filename of the dictionary data file
that the program is trying to open? What is it?

One more thing you can try: Open a command window by clicking Start
menu > Run, typing cmd in the box, and clicking the Run button. Type
in the path

c:\program files\COED11\coed11.exe

This *should* have exactly the same effect as the macro. What happens?

--
Jay

On Tue, 29 Sep 2009 21:33:26 +0100, "Margaret Upton"
<margaretupton@xxxxxxxxxxxxxx> wrote:

Hi Jay

You will be sick of me, this time I got the message "Failed to open COED11
dictionary file", then when you try and start it by double clicking the
icon, it appears minimized on the bar at the bottom of the screen. You
have
to right click it then and maximize it, then resize it. I do appreciate
all
you help, but will understand if you give up !!

Margaret


"Jay Freedman" <jay.freedman@xxxxxxxxxxx> wrote in message
news:OrhGtZTQKHA.1512@xxxxxxxxxxxxxxxxxxxxxxx
I just noticed that there is a space in the path, which I copied and
pasted
from your previous message, between the last slash and the coed11.exe.
Remove it -- or copy and paste this corrected version:

RetVal = Shell("c:\program files\COED11\coed11.exe", vbNormalFocus)

If you get any more debug messages and yellow highlights, if there is
also
a box that mentions an error number and an explanation of the error,
please quote that box exactly. The information will help to be more
certain about what the problem is.

Margaret Upton wrote:
Hi Jay

Thank you for all your help, but I have just pasted that in and now
it just says debug and when you go into the macro its yellow, so its
still not working.

Margaret

"Jay Freedman" <jay.freedman@xxxxxxxxxxx> wrote in message
news:O2bmEwHQKHA.1232@xxxxxxxxxxxxxxxxxxxxxxx
Then paste that into the macro code, between the double quotes, to
replace the previous path --

RetVal = Shell("c:\program files\COED11\ coed11.exe", vbNormalFocus)

Be sure to remove the square brackets from around vbNormalFocus.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

Margaret Upton wrote:
Thank you for replying. There is nothing that says Target, but the
path in properties is c:\program files\COED11\ coed11.exe

Margaret


"Graham Mayor" <gmayor@xxxxxxxxxxxxxxxxxx> wrote in message
news:uUcT8QDQKHA.3540@xxxxxxxxxxxxxxxxxxxxxxx
Right click the item that works on your desktop and select
properties. What is the 'Target'?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Margaret Upton wrote:
Graham

Thank you for your reply, but neither work, have just tried them
both. I am not using Word 2007 (can't stand it !!) have gone back
to 2003. The program I have the same commands for to open a
personal navigator with postcodes still works with the commands
you said, but for some reason the dictionary will not. I can
start the program from the desktop but not from Word. Any more
suggestions. Thanks for your help.
Margaret
"Graham Mayor" <gmayor@xxxxxxxxxxxxxxxxxx> wrote in message
news:e0jgMNCQKHA.1360@xxxxxxxxxxxxxxxxxxxxxxx
This command structure simply allows Word to start an external
application from a macro eg

Sub Calculator()
Dim RetVal
RetVal = Shell("C:\WINDOWS\SYSTEM32\CALC.EXE", 1)
End Sub

will run the calculator.

In your case the macro is trying to start an application
cod10.exe from the C:\Program Files\Cod10 folder.
Assuming the program in question is installed in that folder,
then running the macro should have the same effect as locating
cod10.exe in its folder and running it directly.

As Jay has pointed out, the correct syntax for the command would
be RetVal = Shell("c:\program files\cod10\cod10.exe",
vbNormalFocus)
or
RetVal = Shell("c:\program files\cod10\cod10.exe", 1)

Check that the application is correctly installed and that it
runs by double clicking the file cod10.exe.

Whether it is compatible with Word 2007 is another matter
entirely. What was the error message - verbatim?

See also http://www.gmayor.com/installing_macro.htm


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Margaret Upton wrote:
Jay

Sorry not to get back to you before now, have a new computer, my
husband has the old one, I could not understand last night why
it was not visible on my machine, running Vista, and posted
another message which did not appear either, some went onto his
machine and there was my old and new message !! Have done what
you suggested and it does not work at all now, just says debug
and even when I put the old code back nothing happens. Can you
suggest anything else please. Margaret
"Jay Freedman" <jay.freedman@xxxxxxxxxxx> wrote in message
news:olcvb5h8kru2avjgccgusqd4n8g7j5olrb@xxxxxxxxxx
It would have been useful to know the exact text of the error
message you saw. If you can post that in a reply, please do.

In the meantime, here are two suggestions:

- Find the correct path and filename of the executable file for
the dictionary, and make sure it's exactly the same in the
macro. Maybe it is "c:\program files\cod11\cod11.exe" but maybe
it's something different. Unless the Shell command is given
exactly the correct path, it can't run the program -- computers
never try to guess about such things.

- Remove the square brackets around vbNormalFocus. They don't
belong there.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.


On Sun, 27 Sep 2009 18:30:15 +0100, "Margaret Upton"
<margaretupton@xxxxxxxxxxxxxx> wrote:

I have been using a macro to open the Oxford Dictionary on the
button bar in
Word 2003. The dictionary would open in a small window and if
you double clicked the word it would put it into the
dictionary. I have just had a new
computer and upgraded the version of the dictionary. I am
running Windows Vista (oh how I hate Vista !!!) I changed in
the macro cod10 to cod11, but it will not open the dictionary
and throws up an error message, then when I
went to start the dictionary it just appeared as a minimized
documents at the bottom of the screen. You could right click
it and it you maximized it
of course it would then fill the screen. Eventually I managed
to get it to
work again on the desktop but not in word. Does anyone have
any ideas how to alter the code to get it to work. Would be
grateful for some help please.

Dim RetVal
RetVal = Shell("c:\program files\cod10\cod10",
[vbNormalFocus])



.


Loading