Hi,
ich habe da noch so meine Schwierigkeiten mit dem Verständnis der grundlegenden Sachen in VBA. Deswegen mal eine recht allgemeine Frage zu einem Problem.
Was ich möchte:
Ein Dialogfeld, daß eine Liste der Augenblicklich geöffneten Dokumente anzeigt, und mir die Möglichkeit gibt eines dieser Dokumentre auszuwählen und aktuell zu schalten.
Was ich habe:
Diese beiden Beispiele aus der Acad-Hilfe, die mir schon mal den Weg zeigen, wie man durch die Dokumente "wandert" oder ein Dokument aktiv schaltet.
Sub Example_Documents()
' This example obtains a reference to the Documents collection
' and displays information about the loaded documents.
Dim Document As AcadDocument
Dim msg As String
msg = vbCrLf
' Cycle through the Documents collection and retrieve the names
' of the loaded documents
For Each Document In Documents
msg = msg & Document.Name & vbCrLf
Next
' Display loaded document information
If Documents.Count > 0 Then
MsgBox "The loaded documents are: " & msg
Else
MsgBox "There are no loaded documents!"
End If
End Sub
Sub Example_ActivateMethod()
' This example creates two new drawings and activates each drawing in turn.
Dim NewDrawing1 As AcadDocument
Dim Newdrawing2 As AcadDocument
Set NewDrawing1 = ThisDrawing.Application.Documents.Add("")
Set Newdrawing2 = ThisDrawing.Application.Documents.Add("")
Dim drawing As AcadDocument
For Each drawing In ThisDrawing.Application.Documents
drawing.Activate
MsgBox "Drawing " & drawing.Name & " is active."
Next drawing
End Sub
Was ich nicht kapier:
Wie baue ich ein UserForm für o.g. Funktionalität auf?
Ich brauche 'n "OK"- Knopf und 'ne ListBox schon klar, aber wie muß der Weg aussehen, damit das Ding dann funktioniert? Die ListBox soll beim starten ja gleich die Liste der Dokumente anzeigen... Aber wie geht das? Ich raff's einfach nicht...
Ciao,
Marc
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP