TheSwamp

Code Red => VB(A) => Topic started by: chobo on October 15, 2012, 11:38:02 AM

Title: ACI Color dialog in AutoCAD 2013 VBA
Post by: chobo on October 15, 2012, 11:38:02 AM
Is there a different way to call the ACI(AutoCAD Color Index) color dialog in AutoCAD 2013 VBA?
below code is working very well in AutoCAD 2004 ~ 2012
but not working in AutoCAD 2013 ..

Code: [Select]
Option Explicit

Public Declare Function acedSetColorDialog Lib "acad.exe" _
       (color As Long, _
        ByVal bAllowMetaColor As Boolean, _
        ByVal nCurLayerColor As Long) As Boolean

Sub GetACIColor()
    Dim iColor As Integer
    iColor = GetColorFromDlg(1, True, 256)
    MsgBox iColor
End Sub

Function GetColorFromDlg(ByVal initColor As Long, ByVal bAllowMetaColor As Boolean, ByVal nCurLayerColor As Long) As Long
    GetColorFromDlg = -1
    On Error Resume Next
    If acedSetColorDialog(initColor, bAllowMetaColor, nCurLayerColor) Then
        GetColorFromDlg = initColor
    End If
End Function