Compile Error: Expected=

R

Robert_DubYa

I get "Compile Error: Expected =" when trying to run the following code:

Shell ("C:\Program Files\Internet Explorer\iexplore.exe " & _
"\\TestLocation1\shares\Design\Data\Viewable\Gas\testPart.pdf", _
vbMaximizedFocus)

(the third line of the path is actually all on the second line but this
message board is not long enough).

If I take "vbMaximizedFocus" off the end it works fine, however it does not
bring explorer to the top level of the users screen. I'm not sure what I'm
doing wrong, but I have a simular program I created in VB that works just
fine.

thanks,
Robert
 
D

Douglas J. Steele

Shell is a function. You either need to assign the value it returns (a
Variant) to a variable:

Dim varRet As Variant

varRef = Shell ("C:\Program Files\Internet Explorer\iexplore.exe " & _
"\\TestLocation1\shares\Design\Data\Viewable\Gas\testPart.pdf", _
vbMaximizedFocus)

or use the Call keyword:

Call Shell ("C:\Program Files\Internet Explorer\iexplore.exe " & _
"\\TestLocation1\shares\Design\Data\Viewable\Gas\testPart.pdf", _
vbMaximizedFocus)

or leave off the parentheses:

Shell "C:\Program Files\Internet Explorer\iexplore.exe " & _
"\\TestLocation1\shares\Design\Data\Viewable\Gas\testPart.pdf", _
vbMaximizedFocus
 
R

Robert_DubYa

That worked. Thanks! Funny, the example MS gives has them and it works in
VB2005.
 

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

Top