I noticed in the documentation that I can not catch the copy/cut/paste key events. I would like to be able to catch these and so I thought I would add my own event handler to catch these keys so that visio does not process the cut/copy/paste. I want to process this operation because I have special configurations that need to be done. Is making an event handler with the add advise going to do this or is there a better way? Thank you.
Hi, I have an example to catch when you are going to copy. To try this code, put this code in ThisDocument, and enter run mode, but not limited to key-in, sorry. The message appears when you enter "Cntl+C" or when you select menu "Copy". Private WithEvents m_visApp As Visio.Application Private Sub Document_RunModeEntered(ByVal doc As IVDocument) Set m_visApp = ThisDocument.Application End Sub Private Sub m_visApp_EnterScope(ByVal app As IVApplication, ByVal nScopeID As Long, ByVal bstrDescription As String) If nScopeID = Visio.VisUICmds.visCmdUFEditCopy Then MsgBox "Hi, you are going to copy!" End If End Sub -- Best Regards. JuneTheSecond Now the Visual calculation is more visual. http://www.geocities.jp/visualcalculation/english/index.html
Don't forget Duplicate too...and Cut/Paste "JuneTheSecond )cotton.ocn.ne.jp>" <yodaju62(<o@o> wrote in message news:764FF376-0A2A-46A3-AA47-98354F649CD0@microsoft.com... > Hi, I have an example to catch when you > are going to copy. > To try this code, put this code in ThisDocument, > and enter run mode, but not limited to key-in, sorry. > > The message appears when you enter "Cntl+C" > or when you select menu "Copy". > > Private WithEvents m_visApp As Visio.Application > > Private Sub Document_RunModeEntered(ByVal doc As IVDocument) > Set m_visApp = ThisDocument.Application > End Sub > > Private Sub m_visApp_EnterScope(ByVal app As IVApplication, ByVal nScopeID > As Long, ByVal bstrDescription As String) > > If nScopeID = Visio.VisUICmds.visCmdUFEditCopy Then > MsgBox "Hi, you are going to copy!" > End If > > End Sub > > -- > Best Regards. > > JuneTheSecond > Now the Visual calculation is more visual. > http://www.geocities.jp/visualcalculation/english/index.html > -- David Parker Microsoft MVP (Visio) http://bvisual.spaces.live.com http://www.visualizinginformation.com
I actually ended up catching the keyboard events and did it that way. This is nice too though! The problem I had was that I had no way to prevent visio from performing the paste which I was doing internally with .Paste(). I have figured a way around it but just for the knowledge is there anyway to keep visio from making the paste? Thanks. "JuneTheSecond" wrote: > Hi, I have an example to catch when you > are going to copy. > To try this code, put this code in ThisDocument, > and enter run mode, but not limited to key-in, sorry. > > The message appears when you enter "Cntl+C" > or when you select menu "Copy". > > Private WithEvents m_visApp As Visio.Application > > Private Sub Document_RunModeEntered(ByVal doc As IVDocument) > Set m_visApp = ThisDocument.Application > End Sub > > Private Sub m_visApp_EnterScope(ByVal app As IVApplication, ByVal nScopeID > As Long, ByVal bstrDescription As String) > > If nScopeID = Visio.VisUICmds.visCmdUFEditCopy Then > MsgBox "Hi, you are going to copy!" > End If > > End Sub > > -- > Best Regards. > > JuneTheSecond > Now the Visual calculation is more visual. > http://www.geocities.jp/visualcalculation/english/index.html >
Stumple, You have only to add ,,, If nScopeID = Visio.VisUICmds.visCmdUFEditCut Then MsgBox "Hi, you are going to cut!" End If If nScopeID = Visio.VisUICmds.visCmdUFEditPaste Then MsgBox "Hi, you are going to paste!" End If and, if you include lines to delete the pasted shapes, you might prevent anyone from pasting. -- Best Regards. JuneTheSecond Now the Visual calculation is more visual. http://www.geocities.jp/visualcalculation/english/index.html