In many VB program applications display images. And maybe you want to copy the image and paste into other office program like MS Excel, MS Word, etc. To do this thing in VB6 programming, please follow below steps of simple VB programming tips:
First, you should have a picture that will be loaded by the program. For example you have a picture or image file named Adenium.jpg, and you save your picture in a folder with name D:\MyPicture
Please look at below screen shot for your illustration.
'Load picture into image box
Image1.Picture = LoadPicture("D:\MyPicture\Adenium.JPG")
'Clear clipboard first
Clipboard.Clear
'Load the picture from Image1 into Clipboard
Clipboard.SetData Image1.Picture
So your program will look like the following list:
Private Sub Command1_Click()
'Clear clipboard first
Clipboard.Clear
'Load the picture from Image1 into Clipboard
Clipboard.SetData Image1.Picture
End Sub
Private Sub Form_Load()
'Load picture into image box
Image1.Picture = LoadPicture("D:\MyPicture\Adenium.JPG")
End Sub
Please look at below screen shot for your illustration.
To check whether your program works or not:
If your Image appears on your screen it means that your Sub Form_Load() is working.
If your picture appears on your MS Excel sheet it means that your program is working properly.
It's just a very easy thing to do, isn't it?
2 comments:
It's so easy to copy image into clipboard.
Great stuff! Thanks!!
Regards,
clipping path
Post a Comment