PDA

View Full Version : Problem with Referencing



ccastelein
03-22-2007, 08:37 AM
Hey all, long time....:hi:

Question.. Im trying to write some code that will change the LayerKeyStyles but to get it to work i need to go to Tools>References and add the specific references... other wise i get
"User-defined type not defined"

How do i go about getting rid of this error...
In help it says REFERENCE to use the drop down menu..real helpful...
in the refernce drop down i add
AecXBase47.tlb
AecXArchBase47.tlb
(ADT 2006)

I thought it might be cause the adt environment hasnt been initilized..
so i added this
adtApp.Init acadApp

no go..
any thoughts?

i have half an incling that it might be a SET New line but no idea how to write it.

TIA ccastelein

lucas
03-22-2007, 08:43 AM
AutoCAD?
You want it to set the reference without having to go to the vbe and hitting tools-references?

ccastelein
03-22-2007, 09:12 AM
yes this is in ADT 2006...

yes, this will be invoked by users via the command line...
they will have no clue about adding references they just want it to
work.

im taking baby steps on this routine..first it will just tell me what
LayerKeyStyle is current , and then hopefully i will be able to switch
to a different already defined LayerKeyStyle...

ccastelein
03-22-2007, 09:14 AM
My current code is this:

Public Sub LKS()
adtApp.Init acadApp ' Initialize ADT
Dim acadApp As AcadApplication
Dim adtApp As AecArchBaseApplication
Dim docs As AecArchBaseDocuments
Dim doc As AecArchBaseDocument
Dim dbpref As aecarchbasedatabasepreferences
Set dbpref = AecArchBaseApplication.ActiveDocument.Preferences

Dim laystandard As String
laystandard = dbpref.layerstandard

' Test if layer standard is set
If laystandard = "" Then
laystandard = "not set"
End If

MsgBox "The current value for LayerStandard is: " & laystandard, _
vbInformation, "LayerStandard Example"

End Sub

lucas
03-22-2007, 09:17 AM
http://www.vbaexpress.com/forum/showthread.php?t=11800&highlight=reference

http://www.vbaexpress.com/forum/showthread.php?t=11528&highlight=reference