Hi everybody !
I am a french student in mechanical design, living in Canada, and my last year internship is focused on building some macros (some huge macros) for my firm.
I usually do my VBA work on CATIA (3D design), and I learned a lot in 2 month.
But now, I am stuck in a dead-end (seems to, but I'm here to make it alive again ).
First, my goal :
I am creating a macro, from excel now, that creates new folders for the firm new jobs from a template folder.
Until now, no problem. Everything works perfectly.
But (yeah, here it is) for certain reasons, I have to run CATIA.
It could be easy, but my firm has a "home improved" version, and this one opens only thanks to a shortcut, which we can find on every Desktop, or on the server.
The shortcut is important, because his target is not only a .exe program, it is also the parameters and the environment of the program.

I have the solution, well, almost.

My opening sub works like this :
It creates a batch file on the desktop, then run it, then kill it.
Simple...

Sub BatchToOpenCatia()

' Set FileName for Batch (.bat) file
Const Yourself = "C:\Users\MySession\Desktop\Openit.bat" 'only for the joke, later (also batch files path)
Dim FileNumber As Integer
Dim OverComplicatedCommand As String
Dim ShortcutPath As String

FileNumber = FreeFile
Open Yourself For Output As #FileNumber

'Create the command that will change your life (and also run your Customized Catia shortcut)
ShortcutPath = Environ("USERPROFILE") & "\Desktop\CATIA *.lnk"   'the "*" wildcard is important, _
i don't know why, but Catia won't open if you use the true and complete path.. (tested, many times)

OverComplicatedCommand = "for %%a in (" & Chr(34) & ShortcutPath & Chr(34) & ") do @start " & Chr(34) & Chr(34) & " " & Chr(34) & "%%a" & Chr(34)
'basically.. : for %%a in ("C:\Users\MySession\Desktop\CATIA 3Desco *.lnk") do @start "" "%%a"
'= the command to send to the command prompt

Print #FileNumber, OverComplicatedCommand
Close #FileNumber

'Run the Batch file, PROBLEM HERE !!!!
Call Shell(Yourself, vbMinimizedFocus)

'Delete the Batch file
Kill Yourself 'needed a joke

End Sub
The batch file is created.
The command is well inserted in it.
The batch file work (a simple double click on it runs the command and open the good version of CATIA, Perfect)
BUT when I try to run it through VBA, with the
Call Shell(Yourself, vbMinimizedFocus)
it doesn't work !!!
8 hours of pulling my hairs, trying to find a solution, and here I am.
I thank you for reading me, but I'll thank you more if you find something that would help me ^^

Have a nice day,
Leyooooo