The below seems to throw up an error for me
run time error 5
invalid procedure call or argument
Sub Test_Refresh()
Shell "C:\Plasma\ACD_Refresh.acsauto", 4
End Sub
The below seems to throw up an error for me
run time error 5
invalid procedure call or argument
Sub Test_Refresh()
Shell "C:\Plasma\ACD_Refresh.acsauto", 4
End Sub
Hello Jtwork,
The Shell funtion in VBA can only open executable application files. If you are wanting to open the file in your example, you can use the ShellExecute API. This will only open the file if the file extension is registered. Here is a macro that uses the ShellExecute API function...
Using your file as an example:![]()
Please Login or Register to view this content.
OpenFile("C:\Plasma\", "ACD_Refresh", ".acsauto")
Sincerely,
Leith Ross
Thank you for your help, ive copy and pasted the code into a separate module but im not sure how to execute it.
Ive tried running the function like so in the same and diff module's but i get the following error after entering the openfile function
Compile error:
Expected: =
Sub testthisone()
OpenFile("C:\Plasma\", "ACD_Refresh", ".acsauto")
End Sub
Hello Jtwork,
Sorry about the lack of calling explanation. Your Sub should look like this...
The OpenFile function returns TRUE if the file opened successfully, otherwise it returns FALSE. OpenFile will display an error message if the file fails to open correctly, but without a return value the procedure that called OpenFile has no way of knowing if an error did occur.![]()
Please Login or Register to view this content.
Sincerely,
Leith Ross
this worked thank you ver much for your help
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks