Can someone explian to me what this line of code does?

  • Thread starter Thread starter Ayo
  • Start date Start date
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top