Program-1
checking seleted layer is featurelayer or group layer or raster alyer
--------------------------------------------
Public Sub CheckSelectedLayer()
Dim pMxDocument As IMxDocument
Set pMxDocument = Application.Document
Dim pLayer As ILayer
Set pLayer = pMxDocument.SelectedLayer
If TypeOf pLayer Is IGroupLayer Then
' we have a group layer (GroupLayer)
MsgBox pLayer.Name
ElseIf TypeOf pLayer Is IGeoFeatureLayer Then
' we have a feature layer
MsgBox pLayer.Name
ElseIf TypeOf pLayer Is IRasterLayer Then
' we are check raster layer
MsgBox pLayer.Name
End If
End Sub
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Program-2
Creating Menus and Submenus and add command items
--------------------------------------------------
Public Sub CreateMenu()
' Find the MainMenuBar.
Dim pMainMenuBar As ICommandBar
Set pMainMenuBar = Application.Document.CommandBars.Find(arcid.MainMenu)
' Create the new menu called "MyMenu" on the MainMenuBar.
Dim pNewMenu As ICommandBar
Set pNewMenu = pMainMenuBar.CreateMenu("MyMenu")
' Add a built in command to the new menu.
' The built in ArcID module is used to get the command ID for the AddData
' command.
pNewMenu.Add arcid.File_AddData
'creating submneus and add command items
With pNewMenu
Dim submenu As ICommandBar
Set submenu = pNewMenu.CreateMenu("Region", 0)
submenu.Add arcid.File_Export
Set submenu = pNewMenu.CreateMenu("Basin", 1)
submenu.Add arcid.PanZoom_FullExtent
End With
End Sub
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=
Program-3
Creating Menus and Submenus and add command items
--------------------------------------------------
Public Sub CreateMenu()
' Find the MainMenuBar.
Dim pMainMenuBar As ICommandBar
Set pMainMenuBar = Application.Document.CommandBars.Find(arcid.MainMenu)
' Create the new menu called "MyMenu" on the MainMenuBar.
Dim pNewMenu As ICommandBar
Set pNewMenu = pMainMenuBar.CreateMenu("MyMenu")
' Add a built in command to the new menu.
' The built in ArcID module is used to get the command ID for the AddData
' command.
pNewMenu.Add arcid.File_AddData
'creating submneus and add command items
With pNewMenu
Dim submenu As ICommandBar
Set submenu = pNewMenu.CreateMenu("Region", 0)
submenu.Add arcid.File_Export
Set submenu = pNewMenu.CreateMenu("Basin", 1)
submenu.Add arcid.PanZoom_FullExtent
End With
End Sub
=-=-=-=-==-=-=-=-=-==-=-==--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Program-4
Option Explicit
'creating toolbar
Sub FF()
Dim ss As ICommandBar
Set ss = ThisDocument.CommandBars.Create("dd", esriCmdBarTypeToolbar)
ss.Add arcid.File_AddData
End Sub
=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-==--=
Program-5
Sub ExecuteCmd()
Dim pCmdItem As ICommandItem
' Use ArcID module and the Name of the Save command
Set pCmdItem = Application.Document.CommandBars.Find(arcid.File_Save)
pCmdItem.Execute
end sub
--------
Sub ExecuteCmd2()
Dim pUID As New UID
Dim pCmdItem As ICommandItem
' Use the GUID of the Save command
pUID.Value = "{119591DB-0255-11D2-8D20-080009EE4E51}"
' or you can use the ProgID
' pUID.Value = "esriArcMapUI.MxFileMenuItem"
pUID.SubType = 3
Set pCmdItem = Application.Document.CommandBars.Find(pUID)
pCmdItem.Execute
End Sub
=-=-=-=-=-=-=-=-==-=-=-==-=-=-=-=-=-=-=-=-=-==-=-=-====-=-=-=
http://bitcofarm.com/home?r=Ramki009
No comments:
Post a Comment