![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Mar 2002
Posts: 24
|
Hi,
Can anyone help me? I want to have my users click a command button to open a dialogue to browse for a photo and add it to a field in a worksheet. Please... |
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
'This routine will prompt you for the file location 'Then ask you for the Top cell location to paste to. Sub Insert_Pict() Dim Pict Dim ImgFileFormat As String Dim PictCell As Range Dim Ans As Integer 'ActiveSheet.Protect True, True, True, True, True ImgFileFormat = "Image Files wmf (*.gif),*.gif,(*.bmp),others , jpg (*.jpg),*.jpg" GetPict: Pict = Application.GetOpenFilename(ImgFileFormat) 'Note you can load in nearly file format If Pict = False Then End Ans = MsgBox("Open : " & Pict, vbYesNo, "Insert Picture") If Ans = vbNo Then GoTo GetPict 'Now paste to userselected cell GetCell: Set PictCell = Application.InputBox("Select the cell to insert into", Type:=8) If PictCell.Count > 1 Then MsgBox "Select ONE cell only": GoTo GetCell PictCell.Select 'PictCell.Activate ActiveSheet.Pictures.Insert(Pict).Select End Sub 'to delete ALL picture files then; Sub DeletePicts() Dim Pict As Object For Each Pict In ActiveSheet.Shapes MsgBox "This is " & Pict.Name & ": Type:= " & Pict.Type If Pict.Type = 13 Then Pict.Delete End If Next End Sub |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|