Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

sendercontrol eines sheet ermitteln

4 views
Skip to first unread message

Thomas Martin Mädzulat

unread,
Dec 8, 2008, 10:13:00 AM12/8/08
to
hallo,
wie kann ich in einem sub, das über die .OnAction-methode eines eigenen
PopUp-menus aufgerufen wird, den namen oder eine id des controls in erfahrung
bringen, das das PopUp-click-event ausgelöst hat?

vielen dank für antwort!
Martin

code:

Private Sub txtEineBox_MouseUp(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
If Button = 2 Then
Call PopUpMenuCopyPaste("txtEineBox")
End If
End Sub


Sub PopUpMenuCopyPaste(Sender As String)

Dim MyBar As CommandBar

On Error Resume Next
Application.CommandBars("MyEdit").Delete
On Error GoTo 0

Set MyBar = CommandBars.Add("MyEdit", msoBarPopup, False)

With MyBar.Controls.Add(msoControlButton,
CommandBars("Cell").Controls("Einfügen").ID)
.tag = Sender
.OnAction = "PasteTextInControl"
End With

MyBar.ShowPopup
End Sub


Sub PasteTextInControl()

Dim MyData As New DataObject
Dim strClip As String

On Error GoTo NoText:
MyData.GetFromClipboard
strClip = MyData.GetText

' ### hier soll jedes aufrufende control eingesetzt werden können ###

Workbooks("XY.xls").Worksheets("XY").txtEineBox.text = strClip

NoText:
End Sub

Renke Holert [MVP]

unread,
Dec 13, 2008, 7:30:36 AM12/13/08
to
Hallo,

hier geht es um VBA in Zusammenhang mit MS Project.

Bitte stattdessen die Excel Newsgroup verwenden.

Danke,
Renke

"Thomas Martin Mädzulat" <ThomasMar...@discussions.microsoft.com>
wrote in message news:0FB57D57-5A1E-4D8B...@microsoft.com...

0 new messages