VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SetBlockTableRecordId issue

2 REPLIES 2
Reply
Message 1 of 3
RICVBA
917 Views, 2 Replies

SetBlockTableRecordId issue

I'm coding from within Excel for Office 365 32Bit VBA Application Edition 7.1 and using in a W10 laptop

I'm referencing AutoCAD 2018 Type Library and trying to use the SetBlockTableRecordId  method to insert a block into a Table cell with the following codeline:

 

myTable.SetBlockTableRecordId j + 1, 0, myDoc.Blocks("blockName").ObjectID, True

 

However I'm getting a compiling error with "Compiler error: not corresponding type" as the (hoepfully) closest translation

 

The very same statement doesn't error out if I code in AutoCAD 2018 VBA 7.1 environment

 

I know (or, at least, I think) this has to do with the 32/64 bit thing, and blindly tried ObjectID32 property but to no avail

 

Is anybody aware of a solution?

 

thank you

2 REPLIES 2
Message 2 of 3
norman.yuan
in reply to: RICVBA

Just a quick shoot in the dark.

 

Have you tried this:

 

myTable.SetBlockTableRecordId j + 1, 0, CLngPtr(myDoc.Blocks("blockName").ObjectID), True

 

Norman Yuan

Drive CAD With Code

EESignature

Message 3 of 3
RICVBA
in reply to: norman.yuan

thanks Norman for your reply

 

Yes, it was the first attempt but didn't work and still facing same compile error

it may be of interest that:

- without "CLngPtr", the compile error would highlight the ".ObjectID" part of the statement

- with the "CLngPtr"  the compile error would highlight ".CLngPtr" part

 

I'm thinking that my Excel 32 bit would never handle a call to a method (SetBlockTableRecordId) that is requiring some 64 bit argument

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost