How to correct the error" Name 'ActiveDocument' is not declared."

Author Message
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)
0
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
 
 
 
#1

    Online Bookmarks Sharing: Share/Bookmark

    Jump to:

    Current active users

    There are 0 members and 1 guests.

    Icon Legend and Permission

    • New Messages
    • No New Messages
    • Hot Topic w/ New Messages
    • Hot Topic w/o New Messages
    • Locked w/ New Messages
    • Locked w/o New Messages
    • Read Message
    • Post New Thread
    • Reply to message
    • Post New Poll
    • Submit Vote
    • Post reward post
    • Delete my own posts
    • Delete my own threads
    • Rate post

    2000-2012 ASPPlayground.NET Forum Version 3.9