ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can someone explian to me what this line of code does? (https://www.excelbanter.com/excel-programming/440653-can-someone-explian-me-what-line-code-does.html)

Ayo

Can someone explian to me what this line of code does?
 
Shell (CStr([GoogleEarthExecutableLocation]) & " " & sfilename)

Chip Pearson

Can someone explian to me what this line of code does?
 
The Shell command is used to start another application. In this case,
it would appear that there is a named range called
GoogleEarthExecutable that contains the full file name of the Goggle
Earth program. The square brackets [ ] cause "GoogleEarthExecutable"
to be replace with the contents of that cell. Then, the CStr converts
that text into a string data format. The & " " & sfilename appends a
space followed by the contents of the variable named sfilename to the
exe file name. Finally, that whole string is passed to Shell which
executes it.

It is essentially the equivalent to

Shell "C:\Program Files\GoogleEarth.exe C:\SomeFileName.txt"

This starts the program C:\Program Files\GoogleEarth.exe and passes
the text "C:\SomeFileName.txt" to the program, which uses it in some
fashion unbeknownst to me.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com



On Mon, 15 Mar 2010 10:49:01 -0700, Ayo
wrote:

Shell (CStr([GoogleEarthExecutableLocation]) & " " & sfilename)



All times are GMT +1. The time now is 06:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com