Sorry for my bad English.
I'm making a UserForm for a coin collection. In this UserForm I want to look for a picture, show it in the userform and then insert it into a cell of my sheet.
¿Can someone help me? Thanks
Sorry for my bad English.
I'm making a UserForm for a coin collection. In this UserForm I want to look for a picture, show it in the userform and then insert it into a cell of my sheet.
¿Can someone help me? Thanks
Last edited by VBA Noob; 08-03-2008 at 04:03 AM.
Hi Rachelies.
"In this UserForm I want to look for a picture..."
What is the source of your pictures? Are they already loaded in the userform? Will you need to browse your hard drive for a picture, load and view it in your userform, and then send it to a range?
What have you developed to this point?
I want to do exactly this!!!! Can someone help me to do this? ThanksOriginally Posted by Tom Schreiner
Hi Rachelies.
"I'm making a UserForm for a coin collection."
Help you or do it for you? Do you have anything to post? Have you made any attempt on your own? Please post your code or at least an attachment...![]()
I know how to make the buttons, save the data into the sheet, but i dont know how to make the picture, so I answer. And I will not begin to make the userform if I don´t know how to make the picure,
I only know a few of excel, but I know much about other materies, and if I could, I would help.
Ok. Add UserForm1 with two commandbuttons named BrowseForFile and SendPictureToRange and Image1. The picture is inserted into the same dimenions as the selected range.
Add the following code...
![]()
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Const SW_HIDE As Long = 0 Private Const SW_SHOW As Long = 5 Private LastSelectedFilePath As String Private Sub BrowseForFile_Click() Dim fileToOpen fileToOpen = Application.GetOpenFilename("Picture Files (*.emf; *.wmf; *.jpg; *.jpeg; *.png; *.bmp; *.dib; *.gif; *.tif; *.tiff), *.emf; *.wmf; *.jpg; *.jpeg; *.png; *.bmp; *.dib; *.gif; *.tif; *.tiff") If fileToOpen = False Then Exit Sub Image1.PictureSizeMode = fmPictureSizeModeStretch Set Image1.Picture = LoadPicture(fileToOpen) LastSelectedFilePath = fileToOpen End Sub Private Sub SendPictureToRange_Click() Dim r As Range ShowWindow FindWindow("ThunderDFrame", Me.Caption), SW_HIDE Set r = Application.InputBox("Select the range to insert your picture...", , , , , , , 8) ShowWindow FindWindow("ThunderDFrame", Me.Caption), SW_SHOW With ActiveSheet.Pictures.Insert(LastSelectedFilePath) .Top = r.Top .Left = r.Left .Width = r.Width .Height = r.Height End With End Sub
Check out this example on inserting pics
Select the blue cell and pick a picture.
The example is located from this thread
Last edited by davesexcel; 08-03-2008 at 07:44 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks