Code Red > VB(A)

Vb6 and Set acadApp = GetObject(, "AutoCAD.Application")

(1/2) > >>

Lupo76:
Hello to all,
Many years ago I wrote an application in VB6 and compiled an EXE file.
It worked very well and it still works in BricsCAD.

However in AutoCAD 2016 and Windows 7 64 bit it does not work.
My sense is that the problem is the 64-bit Windows.

Unfortunately I'm very rusty in VB6, as they are years that do not use this programming language :-(

This is the code I wrote:


--- Code: ---            If UserForm7.Option1.Value = True Then
                'AutoCAD FULL
                MsgBox "AutoCAD"
                Set acadApp = GetObject(, "AutoCAD.Application")
             Else
                'BricsCAD
                MsgBox "BricsCAD"
                Set acadApp = GetObject(, "BricscadApp.AcadApplication")
            End If
           
            acadApp.Visible = True
             
            Dim acadDoc As Object
            Set acadDoc = acadApp.ActiveDocument
         

            ReturnPnt = acadDoc.Utility.getpoint(, "Point base: ")

--- End code ---

Is there some way to make it work in AutoCAD is Windows 7 (64-bit) ??

roy_043:
Can you use this instead?:

--- Code: ---Set acadApp = ThisDrawing.Application
--- End code ---

57gmc:
@roy, No, it wouldn't work.

@Lupo
Yes Win7 is 64 bit, but more importantly, acad 2016 is 64 bit. It also uses VBA7 (which you will need to install for it to respond to your code). If you type VBAMAN at the prompt, you will get an error dialog with a link to download the vba install. You will also need to upgrade Visual Studio. There are free versions, so there's no need to continue using VB6.

Lupo76:
Perhaps, I have found a solution and without installing VBA.
The application is in fact written in VB6 and no VBA.

If the solution I've found it works correctly and exceeds the last test I'll be back here to bring it back

57gmc:
Possibly acad cad respond to COM calls without vba installed. I haven't tried it. But you still may need a more current version of VB.

Navigation

[0] Message Index

[#] Next page

Go to full version