Hi, Alfred
>>No, the directory where Visual Studio is installed does not give you the info about the environment your developed/compiled EXE is running. If your EXE is running in 64bit- or 32bit-mode depends only on your project settings.
I did i little search at the program but i really don't know where I can see if the program is setted up as x86 or x64. I'm looking at google but so far I did not find out how to.
>>Set a breakpoint at the line with .Visible, start your exe, let your code wait at the break point and see (in the taskmanager) if the process ACAD.EXE stays alive as long as your code does not execute the codeline with .Visible.
I did this and the acad.exe does not stay alive with the break point at .Visible
>>Execute your code then line-by-line, just to know if AutoCAD stops at the line with .Viisible or AutoCAD stops at the end of your sub (as the variable for the AcadApplication get's destroyed)
As I could not find line-by-line run option like in Office VBA Editor with the F8 key (I did not found it on google either how to, I guess it doesn' have this option) so I set up breakpoints and use F10 (Step Over) e F11 (Step Into) keys. It's not the same result to make a clear answer if it shuts before the End Sub or with it.
>>I have attached a sample (as simple as possible), that works for me and should work for you too.
The program you sent me is pretty much what I want to do but it didn't work either. When I run it I got an error window saying: Error during initialization of AutoCAD: Failed remote procedure call (Exception of HRESULT: 0x800706BE and acad.exe also stops running. I did set breakpoints in your code too and the result was the same. Your program worked for you with the same enviroment configurations? (Windows 8.1 64bit, Autocad 2014 64bit)
Tanks for the help 🙂