We are beginning to purchase 64 bit computers and I am having problems with many of our legacy VBA programs. I understand that we should convert our code to VB.Net, but for now, I need to see if I can get these older programs to work.
As I browse this discussion group, I see that I am not alone with problems in upgrading to 64 bit.
An example of one problem is shown in the sub-routine below. It is used to change the active layout and has worked perfectly for years on our 32 bit computers. The error occurs at ActiveDocument = DOC and the error states, "Compile Error: Invalid Use of Property"
Any help is appreciated and thanks in advance!
Public Sub GotoLayout(LayoutName As String) ' This will go to the layout that is specified Dim DOC As AcadDocument Dim LAY As AcadLayout Dim found As Boolean found = False 'cycle through the layouts in the active document For Each LAY In ThisDrawing.Layouts If LAY.Name = LayoutName Then ThisDrawing.ActiveLayout = ThisDrawing.Layouts.Item(LayoutName) found = True End If Next 'if you have not found the layout yet, then search all open drawings If found = False Then For Each DOC In Documents For Each LAY In DOC.Layouts If LAY.Name = LayoutName Then ActiveDocument = DOC ' <- Here is where the error occurs ThisDrawing.ActiveLayout = ThisDrawing.Layouts.Item(LayoutName) found = True End If Next Next End If 'if you have not found the layout yet, do not continue If found = False Then MsgBox ("The " & LayoutName & " layout could not be found.") End End If