TheSwamp

Code Red => VB(A) => Topic started by: CmdrDuh on November 10, 2007, 03:36:44 PM

Title: 08, VBA, and Vista
Post by: CmdrDuh on November 10, 2007, 03:36:44 PM
Has anyone gotten VBA and 08 to play nicely on Vista?  I brought some of my code from work home, and kept getting catastrophic failures. (Thats what the msgbox says, yet Autocad doesn't crash.)  I'm beginning to think Vista is a really bad thing for Autocad at this point
Title: Re: 08, VBA, and Vista
Post by: MP on November 10, 2007, 03:40:07 PM
Try running AutoCAD as an administrator. Right click shortcut "Run as administrator".

Trying to run Visual BASIC 6 otherwise was a gong show, especially when trying to compile dlls (kept getting a friendly and illuminating 0x80004005 error).

You can set shortcuts to always run as said state (on shortcurt by shortcut basis), which makes it a little easier.
Title: Re: 08, VBA, and Vista
Post by: CmdrDuh on November 10, 2007, 03:46:19 PM
I did the rigft click thing, and that didn't help.
Title: Re: 08, VBA, and Vista
Post by: CmdrDuh on November 10, 2007, 03:46:55 PM
and the sub is very basic
Code: [Select]
Public Sub VPLock()
      On Error GoTo Err_Control
      Dim vp As AcadPViewport
      Dim gpCode(0) As Integer
      Dim dataValue(0) As Variant
      Dim objSelSet As AcadSelectionSet
      gpCode(0) = 0
      dataValue(0) = "VIEWPORT"
      Set objSelSet = ThisDrawing.SelectionSets.Add("VPL")
      objSelSet.Select acSelectionSetAll, , , gpCode, dataValue

      For Each vp In objSelSet
            If vp.DisplayLocked = True Then
                  vp.DisplayLocked = False
            End If
      Next
Exit_Here:
      Exit Sub
Err_Control:
      Select Case Err.Number
      Case "-2145320851"
            ThisDrawing.SelectionSets.Item("VPL").Delete
            Err.Clear
            Resume
      Case Else
            MsgBox Err.Number & Err.Description
            Err.Clear
            Resume Exit_Here
      End Select
End Sub
Title: Re: 08, VBA, and Vista
Post by: MP on November 10, 2007, 03:49:21 PM
YEOW!

Sorry, without a clue (more than normally that is).
Title: Re: 08, VBA, and Vista
Post by: CmdrDuh on November 10, 2007, 03:51:27 PM
Funny thing is, in the local window, 80% of the entries say "No Database" like VBA suddenly lost the connection to the dwg.  Even if Im in the Thisdrawing module.
Title: Re: 08, VBA, and Vista
Post by: MP on November 10, 2007, 03:58:45 PM
I ran your code on machine Cmdr and no errors (Vista Ultimate + AutoCAD '08).

??

(And it did unlock locked viewports).
Title: Re: 08, VBA, and Vista
Post by: CmdrDuh on November 10, 2007, 04:30:33 PM
I have Vista Home Premium i think
edit : Confirmed
Title: Re: 08, VBA, and Vista
Post by: CmdrDuh on November 10, 2007, 04:51:39 PM
You can set shortcuts to always run as said state (on shortcurt by shortcut basis), which makes it a little easier.
MP, How?  I haven't seen this anywhere, but I will admit I haven't looked to hard.  I hate Vista, but I know I will have to learn it soon enough
Title: Re: 08, VBA, and Vista
Post by: CmdrDuh on November 10, 2007, 04:54:57 PM
Just found it. we will see if that fixes my code
Title: Re: 08, VBA, and Vista
Post by: MP on November 10, 2007, 04:55:53 PM
<fingers crossed>
Title: Re: 08, VBA, and Vista
Post by: CmdrDuh on November 10, 2007, 05:09:10 PM
did'nt fix it
Title: Re: 08, VBA, and Vista
Post by: Diněsaur on November 10, 2007, 07:23:00 PM
IT at work is testing Vista Ultimate 64 wit Civil 3D 2008 (crammed FULL of VBA) and is not having any similar issues.
Title: Re: 08, VBA, and Vista
Post by: joseguia on November 11, 2007, 02:11:40 AM
Has anyone gotten VBA and 08 to play nicely on Vista?  I brought some of my code from work home, and kept getting catastrophic failures. (Thats what the msgbox says, yet Autocad doesn't crash.)  I'm beginning to think Vista is a really bad thing for Autocad at this point

Vista/Cad 64Bit or 32Bit?

I have had issues with Vista 64bit and 2008 (64bit), but none with Vista 32 Bit and 2008(32bit).

Title: Re: 08, VBA, and Vista
Post by: CmdrDuh on November 11, 2007, 10:01:59 AM
32 both items.  I wonder if its b/c of the Home Edition?
Title: Re: 08, VBA, and Vista
Post by: CmdrDuh on November 11, 2007, 06:48:35 PM
Well, my prop box quit working, so I did a fresh install of autocad, and it appears to be working now.  Looks like I got acad corrupted somehow.
Title: Re: 08, VBA, and Vista
Post by: hendie on November 12, 2007, 03:39:29 AM
Funny thing is, in the local window, 80% of the entries say "No Database" like VBA suddenly lost the connection to the dwg.  Even if Im in the Thisdrawing module.

a bit late now that you have got it fixed, but.... I have come across that "No Database" error message a few times now and the only way to resolve it is to do another install
Title: Re: 08, VBA, and Vista
Post by: Draftek on November 12, 2007, 08:12:49 AM
Not familiar with that problem but - overall, if you can - get away from vb6 / vba and run as fast as you can.

It's going to become more and more unattractive to code using those tools in the future.
Title: Re: 08, VBA, and Vista
Post by: CmdrDuh on November 12, 2007, 09:33:39 AM
Hendie, thanks, I wish I had known that sooner.

Draftek, I'm still trying to get more than just my foot wet converting to C#.  Seems like every time I get some time to start again, something breaks major-ally at work
Title: Re: 08, VBA, and Vista
Post by: Draftek on November 12, 2007, 09:56:53 AM
I know what you mean,

I've got a project I'm dying to work on but the time required supporting all the old crap I wrote won't allow me to write new crap.. :)