Code Changes Required to VBA Macro so it runs on 64 bit system

Code Changes Required to VBA Macro so it runs on 64 bit system

stevec781
Collaborator Collaborator
1,068 Views
9 Replies
Message 1 of 10

Code Changes Required to VBA Macro so it runs on 64 bit system

stevec781
Collaborator
Collaborator
Hi Guys
I have upgraded to 64 bit Autocad and have lots of macros. I read somewhere that some code changes are need. One from memory was something about the me object not being supported and there was some code to fix this. eg me.hide on a form wont work.

Problem is I dont remember where I saw it and cant find it on google.

Does anyone know where this guide can be found?

I need to get my macros running.

Thanks
Steve
0 Likes
1,069 Views
9 Replies
Replies (9)
Message 2 of 10

Anonymous
Not applicable
Hi Steve,

Have you stepped through the code to see where it is failing?

You can achieve this by telling the Editor to Break on All errors then
running the code normally from the Editor.


Regards,


Laurie Comerford
stevec781 wrote:
> Hi Guys
> I have upgraded to 64 bit Autocad and have lots of macros. I read somewhere that some code changes are need. One from memory was something about the me object not being supported and there was some code to fix this. eg me.hide on a form wont work.
>
> Problem is I dont remember where I saw it and cant find it on google.
>
> Does anyone know where this guide can be found?
>
> I need to get my macros running.
>
> Thanks
> Steve
>
0 Likes
Message 3 of 10

stevec781
Collaborator
Collaborator
The problem is it wont respond to button clicks on the form at all so I cant debug it.

The macro starts and the form loads.

When I press the ok button nothing happens.

I suspect it doesnt like me.hide but I dont kow what to replace it with.

Have tried frmname.hide still nothing happens.
0 Likes
Message 4 of 10

Anonymous
Not applicable
Hi Steve,

Do you have a sub to trap the OK button click event?


Regards,


Laurie Comerford

stevec781 wrote:
> The problem is it wont respond to button clicks on the form at all so I cant debug it.
>
> The macro starts and the form loads.
>
> When I press the ok button nothing happens.
>
> I suspect it doesnt like me.hide but I dont kow what to replace it with.
>
> Have tried frmname.hide still nothing happens.
>
0 Likes
Message 5 of 10

stevec781
Collaborator
Collaborator
Yes it runs fine on my old 32 bit machine. If I take the code and just put it in a module it runs fine on 64 bit so I know the code is fine. I just cant get it to run from the from which I need as it has all the combo boxes etc.

I know in Inventor 64 bit you cant use me.hide so I am wondering of Autocad has a similar limitation.
0 Likes
Message 6 of 10

Anonymous
Not applicable
Because VBA forms run in a separate 32 bit process on x64,
Me.Hide will probably not work the way it does in 32 bit AutoCAD.

Essentially, your VBA application is like a standalone VB program
that runs in its own process, so your form does not behave like a
modal dialog in 64 bit AutoCAD, as it does in 32 bit AutoCAD, it
instead behaves like a window of another running application.

At some point, you have to come to terms with the fact that VBA
is essentially dead because of this and numerous other issues
just like it, and you will need to migrate to VB.NET. It's probably
in your best interest to start thinking about doing that now, rather
than wasting a lot of time trying to get something to work on 64 bit
VBA.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:[email protected]...
Hi Guys
I have upgraded to 64 bit Autocad and have lots of macros. I read somewhere
that some code changes are need. One from memory was something about the me
object not being supported and there was some code to fix this. eg me.hide on a
form wont work.

Problem is I dont remember where I saw it and cant find it on google.

Does anyone know where this guide can be found?

I need to get my macros running.

Thanks
Steve
0 Likes
Message 7 of 10

stevec781
Collaborator
Collaborator
Yes it looks like having to learn .net cant be avoided but I was hoping that someone might know of a quick work around.

In the Inventor help they say this

Use of Me in Document projects is not supported. You can embed a VBA
project in any Inventor document. Usually in a macro within such a project,
you can use Me property to refer to the document itself. On the VBA for
64-bit Inventor, Me object no longer refers to the document. Instead for 32
& 64 bit VBA compatibility, you will need to manually replace all the
references to Me by Me.InventorDocument.

I cant find anything like it in the Autocad help.

Is there a similar work around in acad?
0 Likes
Message 8 of 10

Anonymous
Not applicable
I think the documentation you cite is about the 'Document' object
(the ThisDrawing class in AutoCAD VBA).

Within the ThisDrawing class, code that uses 'Me.Something'
should behave the same as code outside of that class, which
uses 'ThisDrawing.Something'.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:[email protected]...
Yes it looks like having to learn .net cant be avoided but I was hoping that
someone might know of a quick work around.

In the Inventor help they say this

Use of Me in Document projects is not supported. You can embed a VBA
project in any Inventor document. Usually in a macro within such a project,
you can use Me property to refer to the document itself. On the VBA for
64-bit Inventor, Me object no longer refers to the document. Instead for 32
& 64 bit VBA compatibility, you will need to manually replace all the
references to Me by Me.InventorDocument.

I cant find anything like it in the Autocad help.

Is there a similar work around in acad?
0 Likes
Message 9 of 10

Anonymous
Not applicable
We have the same problem - the form button events do not even get triggerred and the form will not close without stopping the code, which can only be done if in debug mode. If you haven't opened up the editor before running the code, which is not an option for end users as it's password protected, the only option is to End Task AutoCAD.

We write all our new stuff in .Net but have a lot of legacy code out there and we didn't realise we would have this problem as it works fine on 32 bit Vista, and Autodesk do not mention that there will be a problem with this on 64 bit so we didn't know until somebody bought a new PC with 64 bit Vista on!

Anyone any ideas short of a costly rewrite?
0 Likes
Message 10 of 10

Anonymous
Not applicable
I posted an update to this but it appears to have disappeared into the ether.
I just wanted to qualify that it is when the form is loaded modelessly that it is inactive and cannot be closed
0 Likes