Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 8th, 2004, 04:06 AM
Registered User
 
Join Date: Oct 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to underscore10304
Default Shell command refusing to work

Hi All,
Hoping someone can help with following prob...
I'm not necessarily new to access but am new to VBA and simply CANNOT get my head round a particular line of code.
I'll explain:
- I have a link that should, when clicked, minimise the active form ( a dialog box w/dropdown ) and launch an external, pre-saved MSWord doc.
Am writing it as follows:

DoCmd.Minimize
Shell ("D:\IT\Display Outlets 2004\merge4access.doc")

...Is it me or am I just not writing this properly? The result is the standard debug/end error popup.
I then typed w/out the preceding 'DoCmd' - this was also unsuccessful.
Every example of the shell command I've looked at is written like this. What am I doing wrong?
Thanks...


 
Old October 8th, 2004, 04:53 AM
Authorized User
 
Join Date: Jul 2003
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I suspect that you need to add the path to the Word program as well:

i.e. Shell ("C:|Program Files\.....\Word.exe" "D:\IT\Display Outlets 2004\merge4access.doc")

Cheers Ray
 
Old October 8th, 2004, 05:08 AM
Registered User
 
Join Date: Oct 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to underscore10304
Default

Hi,
Thanks for your response but I still don't know how to write this line.
It's asking for a separator.
How do I differentiate between the path to the app, THEN the path to the file?
Confused.
Thanks again!

 
Old October 8th, 2004, 01:13 PM
Authorized User
 
Join Date: Oct 2003
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Have you tried putting a space between the program and file/path like this?

Shell ("C:\Program Files\.....\Word.exe D:\IT\Display Outlets 2004\merge4access.doc")
 
Old October 20th, 2004, 02:12 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Hi,

   I am not sure what part of this you are having a problem with still. I wrote this code sample and it does the following:
Minimizes the FORM, not Access
Opens Windows Explorer to the link specified.

Maybe your answer is somewhere here...

Private Sub btn0_Click()

    Dim objExplorer
    Dim stLink As String

    stLink = "http://www.msn.com"

    DoCmd.Minimize

    Set objExplorer = CreateObject("InternetExplorer.Application")
        objExplorer.Navigate stLink
        objExplorer.Fullscreen = True
        objExplorer.Visible = 1

End Sub

 I think you need to create an instance of Word. I think you need the object model for Word. I only have the model for IE.

P.S. Omit the Full Screen command since it opens IE and hides the taskbar, menus and close button.
P.P.S. It is not a shell script, that is only used in cmd.exe (e.g. batch files) so don't use shell command references. If this is not a VBA question, then seek the more pertinent forum.:D



mmcdonal





Similar Threads
Thread Thread Starter Forum Replies Last Post
Running a shell command in sharepoint. Final_Boss SharePoint Development 0 August 17th, 2007 12:24 PM
Shell command under Windows Vista mileski Access VBA 0 April 16th, 2007 10:17 AM
how to alter shell command to direct where window dgr7 Beginning VB 6 4 March 16th, 2007 02:00 PM
Shell command or calling VB exe netfresher General .NET 3 October 30th, 2006 06:23 AM
Shell command execution error toshesh VB Databases Basics 3 January 7th, 2006 03:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.