So I have a VBA sub that assigns a variable to a drawing directly by its name. Trying to do the same thing in VB.NET however, it goes to an error like "Conversion from string to type Integer is not valid". Here is the code in vb.net, I have a opened autocad file named "Drawing3.dwg") and the error comes up in the last row.
Dim acad As AcadApplication
Dim drwg As AcadDocument
acad = GetObject(, "AutoCAD.Application")
drwg = acad.Documents("Drawing3.dwg")
If I use this instead, it goes trough with no issues:
drwg = acad.Documents(0)
Now, in VBA you could either put an integer or a string with the name of the drawing in the parenthesis and it would work, in VB.NET only works with integer it looks like. I was wondering if there is another way around it without having to loop through all opened drawings and have it check the names.
Thanks a lot!