|
Hallo bei mir passiert folgendes
Wenn im strTargetPath das Userform1 vor Ausführen des Makros noch nicht existiert, erhalte ich vor dem Start die Fehlermeldung , dass die Variable 'Userform1' nicht existiert.
Wenn ich dann
Dim UserForm1 As Object
einfüge, erhalte ich bei Userform1.Label1.Caption = "Neu" den Laufzeitfehler 91 Objektvariable oder With-Blockvariable nicht festgelegt.
Public Sub import_Test()
Dim strSourcePath As String, strTargetpath As String
Dim strFrmName As String
strSourcePath = ThisDocument.Path & "\source_Form_Import.docm"
strTargetpath = ThisDocument.FullName
strFrmName = "UserForm1"
Application.OrganizerCopy Source:=strSourcePath, Destination:=strTargetpath, _
Name:=strFrmName, Object:=wdOrganizerObjectProjectItems
UserForm1.Label1.Caption = "Neu"
UserForm1.Show
End Sub
Was ich ich dagegen tun?
Danke
|