Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Developer Toolkits / October 2006

Tip: Looking for answers? Try searching our database.

RunApp with a reference to a non EXE command line argument

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kathy Webster - 11 Oct 2006 22:27 GMT
I have a macro in Access XP whose action is RunApp.
The Action Argument Command Line is:

wpwin12.exe /m-merge.wcm.

This opens WordPerfect and runs the WordPerfect macro "merge.wcm."
It works fine, but WordPerfect recommends I remove everything but
"merge.wcm" from the command line because of some other WP issues.
When I remove "wpwin12.exe /m-" from the command line, leaving only
"merge.wcm" in the command line action argument, Access doesn't understand
the command.  I get an error:

Access can't invoke the application using the RunApp action.

Perhaps RunApp only works with exe's? If I type "merge.wcm" in the windows
Run line (start, run ) it executes fine, so it appears the problem is at the
MS Access level.  How should I call this command line from Access?

TIA,
Kathy
Douglas J. Steele - 12 Oct 2006 00:15 GMT
Yes, RunApp only works with exes.

If you're using a macro, I don't think you have any choice other than using
the first syntax you mentions.

If you switch you using VBA, you might be able to get away with
Application.FollowHyperlink "merge.wcm"

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

>I have a macro in Access XP whose action is RunApp.
> The Action Argument Command Line is:
[quoted text clipped - 16 lines]
> TIA,
> Kathy
Kathy Webster - 12 Oct 2006 18:02 GMT
Thank you. It seems to work... however... I get the MsgBox "Error" also.
In my macro, I put RunCode wpmacro(), and this
is what I put in the module called Module1:

Public Function wpmacro() As Boolean

   On Local Error GoTo Err
        Application.FollowHyperlink "L:\LP\merge.wcm"
Err:
   MsgBox "Error"

End Function

You know me by now, my VB is less than sketchy, so I am useless at
troubleshooting. :-(
-kathy

> Yes, RunApp only works with exes.
>
[quoted text clipped - 25 lines]
>> TIA,
>> Kathy
Kathy Webster - 12 Oct 2006 18:07 GMT
p.s. I forgot to mention that after following your VBA suggestion, this
dialog box that pops up, too:

Dialog Box Title : Microsoft Office
   Opening merge.wcm
   Some files can contain viruses or otherwise be harmful to your computer
.
   It is important to be certain that this file is from a trustworthy
source.
   Would you like to open this file?

What should I do to have the computer trust this file?
-kathy

> Yes, RunApp only works with exes.
>
[quoted text clipped - 25 lines]
>> TIA,
>> Kathy
Douglas J. Steele - 12 Oct 2006 23:54 GMT
Sorry, I'm not aware of what you can do to avoid the security message.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

> p.s. I forgot to mention that after following your VBA suggestion, this
> dialog box that pops up, too:
[quoted text clipped - 39 lines]
>>> TIA,
>>> Kathy
Kathy Webster - 13 Oct 2006 16:38 GMT
Thank you. I am still getting the error message box that I mentioned in the
other email. The macro executes as I want, but Access still gives an error:
In my macro, I put RunCode wpmacro(), and this
is what I put in the module called Module1:

Public Function wpmacro() As Boolean

   On Local Error GoTo Err
        Application.FollowHyperlink "L:\LP\merge.wcm"
Err:
   MsgBox "Error"

End Function

Any thoughts?
-kathy

> Sorry, I'm not aware of what you can do to avoid the security message.
>
[quoted text clipped - 41 lines]
>>>> TIA,
>>>> Kathy
Douglas J. Steele - 13 Oct 2006 21:23 GMT
You're getting the error message because program flow is going to the
message box whether or not an error occurred.

Try:

Public Function wpmacro() As Boolean
On Local Error GoTo Err

  Application.FollowHyperlink "L:\LP\merge.wcm"

Exit:
 Exit Function

Err:
   MsgBox "Error"
   Resume Exit

End Function

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

> Thank you. I am still getting the error message box that I mentioned in
> the other email. The macro executes as I want, but Access still gives an
[quoted text clipped - 59 lines]
>>>>> TIA,
>>>>> Kathy
Kathy Webster - 16 Oct 2006 18:55 GMT
Thanks.  Along these lines, I have another piece of code for another task
that, when erroring, should show the error message and die, but it shows the
error and continues as if an error were not encountered.  The reason is that
this code is step 2 of a 3 step macro.  So step 3 of the macro is
continuing.  How can I make the code die on error, instead of continuing
with step 3 of the macro?
Thanks!

   Public Function CorLib() As Boolean

       On Local Error GoTo LocalError

       ' I deleted code here that identifies variables Filename and
DestName
       ' so that you don't have to wade through it

       FileCopy Filename, DestName

       Exit Function

   LocalError:
       MsgBox "Form has been removed from the Library. Please try again
after you are     returned to the Main Menu."
    'This is where it needs to kill everything and stop the macro that is
running

   End Function

=================

> You're getting the error message because program flow is going to the
> message box whether or not an error occurred.
[quoted text clipped - 78 lines]
>>>>>> TIA,
>>>>>> Kathy
Douglas J. Steele - 16 Oct 2006 23:29 GMT
You're showing VBA code, but talking macros. Macros don't currently have
much available in the way of error checking (they will in Access 2007), so
VBA is really the way to go.

Why isn't all the code in a single VBA module, rather than split?

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

> Thanks.  Along these lines, I have another piece of code for another task
> that, when erroring, should show the error message and die, but it shows
[quoted text clipped - 108 lines]
>>>>>>> TIA,
>>>>>>> Kathy
Kathy Webster - 17 Oct 2006 01:43 GMT
Because my knowledge of VBA code is so limited.  The best I can do is
accomplish some parts of the task through a few lines of a macro, then stick
in RunCode amidst the lines of macro, then go back to macro. I understand
macro conditional statements and drop down choices very well, but not VBA.
I wish I had your skills, but I don't.  :-)

Is there a way to keep step 4 from happening if error is encountered in step
3? Step 3 code is what I pasted below in prior email.

Macro:
1. if this, do this
2. if that, do that
3. if this, RunCode
4. do this

> You're showing VBA code, but talking macros. Macros don't currently have
> much available in the way of error checking (they will in Access 2007), so
[quoted text clipped - 114 lines]
>>>>>>>> TIA,
>>>>>>>> Kathy
Douglas J. Steele - 17 Oct 2006 11:24 GMT
To be honest, I never use macros because, as I said earlier, they don't have
much error handling ability.

I don't believe what you're trying to do is possible using a macro, but
perhaps one of the macro experts will jump in with a possibility.

The VBA you've shown is fairly straight-forward, though. If you wanted the
copy done and then the WordPerfect macro opened, you'd just put the commands
one after the other:

Public Function wpmacro() As Boolean
On Local Error GoTo Err

 FileCopy Filename, DestName
 Application.FollowHyperlink "L:\LP\merge.wcm"

Exit:
  Exit Function

Err:
  MsgBox "Error"
  Resume Exit

End Function

Now, if the file copy failed, the FollowHyperlink statement will not be
executed, since the error handling would exit the function.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

> Because my knowledge of VBA code is so limited.  The best I can do is
> accomplish some parts of the task through a few lines of a macro, then
[quoted text clipped - 130 lines]
>>>>>>>>> TIA,
>>>>>>>>> Kathy
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.