Error putting other parameters in the Shell () function

2

I am trying to use the Shell() function of Vba in office 2010 , however it is returning me the following error:

  

Compile error

     

Expected Error: =

My code looks 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)

Looking at the documentation and even then still giving error.

    
asked by anonymous 10.06.2015 / 15:45

1 answer

3

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

Shell programa, vbNormalFocus

Or assigning the value of the function to a variable (in which case you need the parentheses):

chamada = Shell(programa, vbNormalFocus)
    
10.06.2015 / 16:15