Error placing other parameters in Shell() function

Asked

Viewed 196 times

2

I’m trying to use the function Shell() of Vba in the office 2010, but is returning me the following error:

Build error

Erra Esperado:=

My code is like this:

Dim programa As String: programa = "caminho do programa"

'Somente assim funciona
Shell(programa)

'Setando o parâmetro windowstyle ocorre o erro acima.
Shell(programa, vbNormalFocus)

I was looking at documentation and yet you keep making a mistake.

1 answer

3


Your problem is calling the function Shell with parentheses and without assigning the function value to a variable. You can solve the problem by taking parentheses:

Shell programa, vbNormalFocus

Or by assigning the value of the function to a variable (and in this case requires parentheses):

chamada = Shell(programa, vbNormalFocus)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.