The information in this article applies to:
SUMMARYIn Microsoft Excel, Visual Basic Help contains incorrect information about the pathname and windowstyle parts of the Shell function. PathnameIn the description of the pathname part, Help states that "[the shell function] may also be the name of a document that has been associated with an executable program."This information is incorrect. You will receive an error message (even if the documents exist and are properly associated with applications) if you use the commands: Shell ("c:\excel\network.txt") -and- Shell ("c:\winword\sample.doc")The shell function cannot launch another program if the name of a file associated with that program is passed to the shell function. If the pathname argument is the name of a document, not the name of an application, you will receive the error message To work around this situation, include the name of the application. as in the following examples: Shell ("notepad.exe c:\excel\network.txt") -or- Shell ("c:\winword\winword.exe c:\winword\sample.doc") WindowstyleThe text implies that the windowstyle argument can be used to determine the window size and focus status of the launched application. This information is only partially correct: if windowstyle is included, you must enter a variable name and equal sign to the left of the Shell command in order for the command to be accepted.The Shell statement cannot stand alone when the argument is used. For example, this command will work RetVal = Shell ("c:\windows\calc.exe", 2)but this command will not: Shell ("c:\windows\calc.exe", 2)If you attempt to enter this second line, you will receive the error message "Expected: )" and the comma in the command will be highlighted. MORE INFORMATIONTo find the Shell Function in Help, choose the Search button in Visual Basic Help and type: Shell
Keywords : |
Last Reviewed: August 26, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |