[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.
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?
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:
InsertPictureInRichTextBox AnalOutput.Out, LoadPicture("C:\Documents and Settings\Owner\Desktop\strakeInWindTunnel.bmp")
Re: User Defined type not defined error due to StdPicture
Nice catch si ;) didnt notice that
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
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...
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