Jump to content

VBA Macros in AutoCad 2015


Joro--

Recommended Posts

Hello all,

 

does anybody know whether the VBA Macros work with AutoCad 2015?

 

The problem is that my Autocad at work will be changed from 2013 to 2015 and I don't know will I be able to use the macros that I currently use with 2013. For 2013 I use the VBA Enabler, but I have heard that there are no Enablers for 2014 and 2015 and there is smth like VBA7...???

 

Thanks in advance for any info.

 

Joro

Link to comment
Share on other sites

FWIW - I am not aware of major changes to the ActiveX API (for Visual LISP), but can tell you that there are version-specific changes to 2015 .NET API that require apps to be recompiled.

 

Methinks you're going to have to install it and test each of your macros just as you would for any other version change.

 

HTH

Link to comment
Share on other sites

If any of your routines open a specific database inside Autocad like CIV3D AeccXUiland you will need a new version number for 2015

 

(if ((lambda (vrsn)
       (cond
        ((vl-string-search "R17.2" vrsn) (setq appstr "6.0")) ;09
        ((vl-string-search "R18.0" vrsn) (setq appstr "7.0")) ;10
        ((vl-string-search "R18.1" vrsn) (setq appstr "8.0")) ;11
        ((vl-string-search "R18.2" vrsn) (setq appstr "9.0")) ;12 ?
        ((vl-string-search "R19.0" vrsn) (setq appstr "10.0")) ;13 
        ((vl-string-search "R19.1" vrsn)(setq appstr "11.0"));;2014
        ((vl-string-search "R20.0" vrsn)(setq appstr "12.0"));;2015
        ((alert "This version of C3D not supported!"))
       )
      )
      (vlax-product-key)
     )     

(strcat "AeccXUiLand.AeccApplication." appstr)

Link to comment
Share on other sites

Since AutoCAD 2014 AutoCAD uses the VBA engine VB7.1 which is not 100% compatible with the preceeding VB6 version. 32 bit controls are no longer useable so macros using such controls will need to be modified, but basically all of your macros can be used. A VBA enabler is available for AutoCAD 2015. But as BlackBox said you should test ALL of your existing macros on 2015.

 

IMO you should consider transferring all of your macros to .NET.

Link to comment
Share on other sites

IMO you should consider transferring all of your macros to .NET.

 

1+

 

To build on Tyke's apt comment, while you may think it easiest to start learning VB.NET for the relatively common syntax of VBA (I did the same when stepping up from Visual LISP), you may find it much easier to instead learn C# due to the abundance of good source code samples available, and it really helps you mentally compartmentalize the distinction between VBA and VB.NET which bites a lot of folks in the end so-to-speak.

 

Cheers

Link to comment
Share on other sites

After many years of writing programs in VB.NET and VBA I have just started out writing in C# and find it no problem what soever. BlackBox's comment is very true, there are so many more examples out there for C#.

 

You can use the free express editions of Visual Studio to get you started with .NET.

Link to comment
Share on other sites

After many years of writing programs in VB.NET and VBA I have just started out writing in C# and find it no problem what soever.

 

cuukher4j893flvyq2kwx3y1m.275x350x1.jpg

 

 

 

BlackBox's comment is very true, there are so many more examples out there for C#.

 

*Tips hat* :beer:

 

 

 

You can use the free express editions of Visual Studio to get you started with .NET.

 

That's how I got started with .NET... Now I find myself to be published at Autodesk Exchange, and a new Microsoft BizSpark member :geek: ... Gosh darn it, the song "Handlebars" by Flobots is stuck in my head now. :rofl:

 

Cheers

Link to comment
Share on other sites

some months ago I cheated my nickname and decided to give .NET development a try for my autocad customizitation needs.

so I started learning C# and VS with no regard to autocad, as they wisely told me to do.

now I'm somehow ready to dirty my hands with an autocad application but I'm still mesmerized by the VS, .NET Framework, .ARX and .NET Wizards, SDK and Autocad versions mix issue.

I begun and try to see it through (http://www.theswamp.org/index.php?topic=10369.15) but I eventually did not succeed. not even remember why. just gave it up and went on concentrating on C# and hoping my company would upgrade Autocad.

 

Now my company agreed on installing VS Express 2012 or 13, but still stuck on Autocad 2010. And I'd be willing to start that again from where I left it.

Maybe you could give me some more hints as to what version and in which order have I to install of AutocadNET Wizard, ObjectARX Wizard, and whatever else should there be useful.

 

thank you

 

 

thank you

Link to comment
Share on other sites

some months ago I cheated my nickname and decided to give .NET development a try for my autocad customizitation needs.

so I started learning C# and VS with no regard to autocad, as they wisely told me to do.

now I'm somehow ready to dirty my hands with an autocad application but I'm still mesmerized by the VS, .NET Framework, .ARX and .NET Wizards, SDK and Autocad versions mix issue.

I begun and try to see it through (http://www.theswamp.org/index.php?topic=10369.15) but I eventually did not succeed. not even remember why. just gave it up and went on concentrating on C# and hoping my company would upgrade Autocad.

 

Now my company agreed on installing VS Express 2012 or 13, but still stuck on Autocad 2010. And I'd be willing to start that again from where I left it.

Maybe you could give me some more hints as to what version and in which order have I to install of AutocadNET Wizard, ObjectARX Wizard, and whatever else should there be useful.

 

We'd be happy to help... Try reading through some of the recent threads in the .NET forum, as you're not alone.

 

I have a submittal, and some server upgrades to spec out today, and will check back as time permits, should someone smarter than I not have already helped you. :thumbsup:

 

Cheers

Link to comment
Share on other sites

Since AutoCAD 2014 AutoCAD uses the VBA engine VB7.1 which is not 100% compatible with the preceeding VB6 version. 32 bit controls are no longer useable so macros using such controls will need to be modified, but basically all of your macros can be used. A VBA enabler is available for AutoCAD 2015. But as BlackBox said you should test ALL of your existing macros on 2015.

 

IMO you should consider transferring all of your macros to .NET.

 

Tyke,

Thanks for your explanation. In my macros I use codelines like

 

Dim L as AcadLine

Or

Dim B as AcadBlockReference

 

With the corresponding syntaxis. Do you think, that this would newd to be actualized everywhere in my code. Thid is infact no real library referencing. As to my underszanding the syntax of vba doesnt change?

Link to comment
Share on other sites

Thanks for your explanation. In my macros I use codelines like

 

Dim L as AcadLine

''Or

Dim B as AcadBlockReference

 

With the corresponding syntaxis. Do you think, that this would newd to be actualized everywhere in my code. Thid is infact no real library referencing. As to my underszanding the syntax of vba doesnt change?

 

VBA (ActiveX COM API) is VBA (ActiveX COM API) regardless of version, so the syntax remains the same... It's changes to the Object Model you need to account for, during migration.

 

As an example, when one Object's Properties, Methods, and Events is moved to different assembly reference than it was in previous version... Probably not as common in COM, as it is in .NET API since the advent of Core Console.

Link to comment
Share on other sites

We'd be happy to help... Try reading through some of the recent threads in the .NET forum, as you're not alone.

 

I have a submittal, and some server upgrades to spec out today, and will check back as time permits, should someone smarter than I not have already helped you. :thumbsup:

 

Cheers

 

 

I got my "Hello World" kick off running.

But where can I get the Autocad API reference, as I could with "AutoCAD ActiveX and VBA Reference"? There I could get extensive explanations and examples too.

 

 

I already went through http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer's%20Guide/index.html but it's much less wordy and, mainly, seems to lack a lot of references. I need to get at help/reference for all of the classes, and their properties and methods, that I can see in the object browser for AcdbMgd.dll and the likes.

Link to comment
Share on other sites

A full listing of the ARX APIs, both managed (.Net) and native, can be found here:

 

 

http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=785550

 

 

These docs do not contain examples - as did the VBA Reference - but do provide fully qualified namespace listings to use via web search. Chances are, a pertinent example is out there.

MngARX.jpg

Link to comment
Share on other sites

thank you Seant

so this means there's no chance to reach the help relevant topic by pressing F1 while coding in the IDE, rather I have to open those "chm" files separately, isn't it?

Link to comment
Share on other sites

Hello,

 

As far as I understand the most of the things remaim the same in VBA7.1.

 

Can you post several code lines with changes comparing to old VBA.

 

10x

Link to comment
Share on other sites

Almost all of the things in VB7.1 remain the same as in the previous VB6. The syntax and functions have not changed at all (as far as I am aware). But all of the 32 bit controls are no longer available, no timer control, no file dialogs for opening and saving files, the SHELL function doesn't seem to work any more - or at least in two of my programs. No big things really as you can build the controls yourself and use the Windows API for your file operations.

 

As BlackBox quite rightly said, test all of your macros now in their current form. If some don't work try fixing them yourself (it's the best way to learn) and if you get stuck post your problem here. Google will come up with loads of answers for you. You will be pleasantly surprised how many of your macros will still run under VB7.1.

 

Good luck.

Link to comment
Share on other sites

As BlackBox quite rightly said, test all of your macros now in their current form. If some don't work try fixing them yourself (it's the best way to learn) and if you get stuck post your problem here. Google will come up with loads of answers for you. You will be pleasantly surprised how many of your macros will still run under VB7.1.

 

Good luck.

 

*Tips hat* ... Cheers, Tyke. :beer:

 

 

 

@Joro--, Do you have access to the VBA source code, or is it password locked?

 

I only ask as I found a way to 'unlock' VBA source code while at my last employer.

 

[PeterGriffinVoice]

 

Ehhhehehehe

 

[/PeterGriffinVoice]

 

Cheers

Link to comment
Share on other sites

Txanks Tyke,

 

This is actually what I really needed. I will definitely check all my macros. The important thing was that there are really not many things to change, because I habe made some pretty long VBA Macros (tausends of rows) an it would tale really long to repair them. And then I would prefer to stay with the old Autocad.

 

BlackBox, yes I have the passwords for the code

 

Regards

Joro

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...