Compile Error: Expected=

  • Thread starter Thread starter Robert_DubYa
  • Start date Start date
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
 
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
 
That worked. Thanks! Funny, the example MS gives has them and it works in
VB2005.
 
Back
Top