sumit_rai
-
Total Posts
:
1
- Scores: 0
-
Reward points
:
0
- Joined: 8/20/2007
-
Status: offline
|
How to correct the error" Name 'ActiveDocument' is not declared."
Tuesday, August 21, 2007 5:38 AM
( permalink)
Im a newbie to VB programming. Some part of this code is from net. I want to use three buttons to copy cut and paste . I am getting this error "Name 'ActiveDocument' is not declared. " Please help me .... if possible can you correct this code.
Public Class Form1
' Three simple macros to implement a secondary clipboard
' Global to act as clipboard
Dim g_lpszSecondClipBoard = ""
Sub SecondaryClipBoardCut()
'DESCRIPTION: Performs a cut of current selection to a secondary clipboard.
g_lpszSecondClipBoard = ActiveDocument.Selection.Text
ActiveDocument.Selection.Text = ""
End Sub
Sub SecondaryClipBoardCopy()
'DESCRIPTION: Performs a copy of current selection to a secondary clipboard.
g_lpszSecondClipBoard = ActiveDocument.Selection
End Sub
Sub SecondaryClipBoardPaste()
'DESCRIPTION: Performs a paste of secondary clipboard to the current selection.
ActiveDocument.Selection = g_lpszSecondClipBoard
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SecondaryClipBoardCut()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
SecondaryClipBoardCopy()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
SecondaryClipBoardPaste()
End Sub
End Class
|
|
|
|