question

JuergenHoffmann-6386 avatar image
0 Votes"
JuergenHoffmann-6386 asked TvanStiphout commented

VBA Command Shell Syntax

Hello, I just want to open a file.
In this example the CALC, exe runs without problems,
The file, a soundtrack, cannot be found in the code at the end, why? The code has only been modified, but basically remained the same. Calc can be started but the soundtrack cannot?

Private Sub TestFeld_DblClick(Cancel As Integer)
'Testfeld
'Dim Ergebnis
'Ergebnis = Shell("C:\WINDOWS\system32\CALC.EXE", 1)
'Close
'___
Dim Start
Start = Shell("C:\Vokabel\34blabla.vma", 1)
End Sub

I need that call, becouse i working on my own Learn DB.
Can some please help me.

office-vba-dev
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Castorix31 avatar image
0 Votes"
Castorix31 answered TvanStiphout commented
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Castorix is correct. To explain the difference: Shell is smart enough to run simple executables. Those files have a ".exe" extension. It is NOT smart enough to do what File Explorer does when you double-click a vma file, a txt file, or whatever, which is to invoke the registered application for that file extension and pass in the filename. ShellExecute is that smart.

0 Votes 0 ·