Results 1 to 7 of 7

Thread: [RESOLVED] User Defined type not defined error due to StdPicture

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2006
    Posts
    55

    Resolved [RESOLVED] User Defined type not defined error due to StdPicture

    Please help. I am using the clipboard to paste an image into a richtextbox. I have found some documentation on how to achieve this but I am unable to compile.

    Here is the code I have:
    Public Sub InsertPictureInRichTextBox(RTB As RichTextBox, Picture As StdPicture) 'Here is where I receive the error due to Picture as StdPicture
    Clipboard.Clear
    Clipboard.SetData Picture

    SendMessage RTB.hwnd, WM_PASTE, 0, 0
    End Sub


    Private Sub Form_Load()


    Open AnalFileName$ For Output As #1
    Print #1, "This is a test of Text above a graphic"

    InsertPictureInRichTextBox AnalOutput.Out, "C:\Documents and Settings\Owner\Desktop\strakeInWindTunnel.bmp"


    Print #1, "This is TEXT BELOW the graphic"


    Close #1
    AnalOutput.Out.LoadFile AnalFileName$, 1

    End Sub

    Thanks in advance for your help.

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: User Defined type not defined error due to StdPicture

    odd... what happens when you type

    Picture As

    do you have stdPicture as an available choice?
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: User Defined type not defined error due to StdPicture

    A filename is not a picture - you need to actually load the picture (using the LoadPicture function) before passing it to the sub, eg:
    VB Code:
    1. InsertPictureInRichTextBox AnalOutput.Out, LoadPicture("C:\Documents and Settings\Owner\Desktop\strakeInWindTunnel.bmp")

  4. #4
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: User Defined type not defined error due to StdPicture

    Nice catch si didnt notice that
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  5. #5

    Thread Starter
    Member
    Join Date
    Jun 2006
    Posts
    55

    Re: User Defined type not defined error due to StdPicture

    Even if I load the picture into the object I am still unable to compile.

    Dim MyPicture As StdPicture 'The StdPicture doesn't appear after As


    MyPicture = LoadPicture("C:\Documents and Settings\Owner\Desktop\strakeInWindTunnel.bmp")
    InsertPictureInRichTextBox AnalOutput.Out, MyPicture

    Is there a Reference or a Component I should be referring to that would allow me to use the StdPicture?

    Thanks

  6. #6
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: User Defined type not defined error due to StdPicture

    No??

    start a new project then type this

    Dim sPic As StdPicture

    if the StdPicture is still not showing then post what references you have as defaults...
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  7. #7

    Thread Starter
    Member
    Join Date
    Jun 2006
    Posts
    55

    Re: User Defined type not defined error due to StdPicture

    Thanks Static,

    I opened a new project and StdPicture appeared as an option. I compared the new project's References to my current project's References and in my current project's References I didn't have OLE Automation selected. As soon as I selected OLE Automation it showed up.

    Thanks again,
    Clint

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width