Autocad 2000 VBA Macro to Autocad 2009

Autocad 2000 VBA Macro to Autocad 2009

Anonymous
Not applicable
1,031 Views
5 Replies
Message 1 of 6

Autocad 2000 VBA Macro to Autocad 2009

Anonymous
Not applicable

Hi,

Would it be possible to migrate my Autocad 2000 VBA customization to Autocad 2009 VBA, what it does in Autocad 2000 when it loads, it creates a toolbar which has customized command. When i try it to Autocad 2009 the toolbar no longer loads.

 

Appreciate any help.

 

Thanks,

Mayller

0 Likes
1,032 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable

Can you post your code here?

0 Likes
Message 3 of 6

Anonymous
Not applicable

Hi Steven,

 

Did some googling and found a few good resolution, btw i have a new problem now. I already able to load the toolbar and one of the button is producing Activex component cant create object here is the script from where it occured:

 

 

Private Sub TabBlocks_Change()
Dim Pic As Picture
Dim sItemStr As String
Dim intIndex As Integer
Dim ItmList As ListItem
Dim sIniAppName As String
Dim sItemX As String, sItemY As String
Dim intlen As Integer, intItmCount As Integer
Dim sItemName As String, sItemBitmap As String, sItemCommand As String
Dim intItemX As Integer, intItemY As Integer, intImageIndex As Integer

If bInitialising Then Exit Sub

'Note that TabBlocks.Tabs is a zero base array while our ini file starts with 1
sIniAppName = "Tab" & TabBlocks.SelectedItem.Index + 1
intItmCount = GetPrivateProfileInt(sIniAppName, "ItemCount", 0, msIniFileName)
ListViewBlocks.ListItems.Clear

Set ListViewBlocks.Icons = Nothing
Set mImageListBlocks = Nothing 'Unload all the previous images explicitly
Set mImageListBlocks = New ImageList

For intIndex = 1 To intItmCount
sItemStr = GetProfileString(msIniFileName, sIniAppName, "Item" & intIndex, "Error")
If sItemStr <> "Error" Then
sItemName = GetToken(sItemStr, ",")
sItemBitmap = GetToken(sItemStr, ",")
sItemY = GetToken(sItemStr, ",")
sItemX = GetToken(sItemStr, ",")
sItemCommand = sItemStr

On Error Resume Next
Set Pic = Nothing
Set Pic = LoadPicture(msBmpDir & sItemBitmap)
On Error GoTo 0
If Not Pic Is Nothing Then
intImageIndex = mImageListBlocks.ListImages.Add(, , Pic).Index
If intImageIndex = 1 Then ListViewBlocks.Icons = mImageListBlocks

With ListViewBlocks.ListItems.Add(, , " ", intImageIndex)
.Left = (CInt(sItemX) - 1) * 35
.top = (CInt(sItemY) - 1) * 35
.tag = sItemCommand
End With
End If
End If
Next
ListViewBlocks.Refresh
End Sub

 Somehow the error occurs in:

Set mImageListBlocks = New ImageList

 

What could be wrong.

 

Thanks,

Mayller

0 Likes
Message 4 of 6

Anonymous
Not applicable

What is the exact error you are getting?

0 Likes
Message 5 of 6

Anonymous
Not applicable

This was the exact error:

 

Runtime Error 429 - ActiveX Component Cannot Create Object.

0 Likes
Message 6 of 6

Anonymous
Not applicable

Unfortunately, I can't debug this with just the code you have posted. Perhaps somebody with more experience can help here?

 

Have you googled for "vba imagelist runtime error 429"? There are different reasons listed for this error happening and I don't know which would apply to your situation.

 

0 Likes