Very simple question to ask, I haven't been able to figure it out up to now though...
How would you focus your ArcMAP application window using VBA?
I have a script that runs and selects polygons and zooms to them, but i would like arcmap to focus and come to the front at that point.
Suggestions?
Dim pDoc As IDocument
Dim pApp As IApplication
Dim pAppROT As IAppROT
Set pAppROT = New AppROT
If pAppROT.Count > 0 Then
Dim p As Integer
Dim x As Integer
p = 0
x = 0
Do While p < pAppROT.Count
If TypeOf pAppROT.Item(p) Is IMxApplication And (pAppROT.Item(p).Document.Title Like "Report.mxd") Then
Set pDoc = pAppROT.Item(p).Document
Set pApp = pDoc.Parent
x = 1
pAppROT.Item(p).Visible = True
End Sub
Set focus = pAppROT.Item(p)
Exit Do
Else
End If
p = p + 1
Loop
End If
If x = 0 Then
Set pDoc = New MxDocument
Set pApp = pDoc.Parent
pApp.OpenDocument ("c:\Report.mxd")
pApp.Visible = True
End If'