tryagaaa

UIToolControl on a VBA form?

Discussion created by tryagaaa on May 24, 2011
Hi,

I have same problem with this post

[HTML]http://forums.esri.com/Thread.asp?c=93&f=992&t=112228[/HTML]

But when I following the step from the post

I receive a error message says

"object required"
following is my code
Private Sub CommandButton4_Click()
Dim pApp As Application
Set pApp = Application

Dim pCommandItem As ICommandItem
  Set pCommandItem = m_pApp.ThisDocument.CommandBars.Find("Project.UIToolControl1")
  Set m_pApplication.CurrentTool = pCommandItem



End Sub

The error is happen in

Set pCommandItem = m_pApp.ThisDocument.CommandBars.Find("Project.UIToolControl1")

how to fix it??

i have solved problem here

Dim pApp As Application
Set pApp = Application

Dim pCommandItem As ICommandItem
Set pCommandItem = pApp.Document.CommandBars.Find("Project.UIToolControl1")
Set pApp.CurrentTool = pCommandItem



but there's an other problem

when I click the button in the form

it's can't change to the map that I can choose the Point on the map!!

following is my UITool code
Private Sub UIToolControl1_MouseDown(ByVal button As Long, ByVal shift As Long, ByVal x As Long, ByVal y As Long)

Dim pMapp As IMxApplication
Dim pSDisplay As IScreenDisplay
Dim pPoint As IPoint
Set pMapp = Application
Set pSDisplay = pMapp.Display
Set pPoint = pSDisplay.DisplayTransformation.ToMapPoint(x, y)
MsgBox "X" & pPoint.x & "_" & "Y" & pPoint.y

End Sub


please help me out!!

Outcomes