russell84 Posted November 7, 2008 Posted November 7, 2008 Hey guys on my pc the AcPreview ActiveX Control Module(This is the vba library) is missing and i was just wondering if anyone know how i can replace this because now i cant run a vba sub that was given to me. Please help Cheers Here is the code Option Explicit Dim objDbx As AxDbDocument ' Example of batch for listing all block names on all drawings in a directory. Private Sub ListBlockNames() Set objDbx = GetInterfaceObject("ObjectDBX.AxDbDocument.17") Dim inDir As String Dim elem As Object Dim filenom As String Dim WholeFile As String Dim newHeight As Double inDir = "c:\program files\autocad 2008\sample" filenom = Dir$(inDir & "\*.dwg") Do While filenom <> "" ThisDrawing.Utility.Prompt vbCrLf & "File: " & filenom ThisDrawing.Utility.Prompt vbCrLf & "-----------------" WholeFile = inDir & "\" & filenom objDbx.Open WholeFile For Each elem In objDbx.Blocks If elem.IsXRef = False And Left(elem.Name, 1) <> "*" Then ThisDrawing.Utility.Prompt vbCrLf & elem.Name End If Next Set elem = Nothing filenom = Dir$ ThisDrawing.Utility.Prompt vbCrLf Loop Set objDbx = Nothing End Sub Quote
russell84 Posted November 7, 2008 Author Posted November 7, 2008 Dont worry guys i have got my hands on the acpreview.ocx Thanks heaps Quote
russell84 Posted November 7, 2008 Author Posted November 7, 2008 The above code i posted will list all blocks within a set of drawings without opening them - does anyone know how to improve it so it will also list the attribute values of any attributes within blocks aswell?? That would be unreal. Also maybe to change the attribute values Quote
Recommended Posts
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.