Option
Explicit
Public
Sub
test()
Const
BOX_NAME
As
String
=
"Textfeld 1"
Dim
objTextBox
As
Excel.TextBox
Dim
dblLeft
As
Double
, dblTop
As
Double
For
Each
objTextBox
In
Worksheets(
"Pizza"
).TextBoxes
With
objTextBox
If
.Name = BOX_NAME
Then
dblLeft = .Left
dblTop = .Top
Call
.Delete
Exit
For
End
If
End
With
Next
If
objTextBox
Is
Nothing
Then
Call
MsgBox(
"TextBox mit diesem Namen wurde "
& _
"nicht gefunden..."
, vbExclamation)
Else
Application.ScreenUpdating =
False
Call
Worksheets(
"Rezept"
).TextBoxes(BOX_NAME).Copy
Call
Worksheets(
"Pizza"
).Paste
If
TypeOf
Selection
Is
Excel.TextBox
Then
With
Selection
.Left = dblLeft
.Top = dblTop
.Name = BOX_NAME
End
With
End
If
Set
objTextBox =
Nothing
Application.ScreenUpdating =
True
End
If
End
Sub