PDA

View Full Version : Solved: Hidden Ribbon



traveler7739
09-27-2010, 03:01 PM
Hello,

I need your help. I have an Excel '07 worksheet that has a hidden ribbon in order to limit the UI. This was done to prevent damage to the worksheet and make the data entry easier. However, on one of the worksheets within this workbook I would like the user to be able to attach a small jpeg picture. Can this be accomplished in VBA? I tried the SendKey method without success. Is there another way? Please advise.

Thank you!!

Jan Karel Pieterse
09-27-2010, 10:58 PM
I think it can be as simple as this:

Sub InsertPictureExample()
Dim vFilename As Variant
Dim sPath As String
sPath = "c:\YourPathGoesHere\"
ChDrive sPath
ChDir sPath
vFilename = Application.GetOpenFilename("picture files (*.jpg),*.jpg", , "Please select the file to insert", , False)
If TypeName(vFilename) = "Boolean" Then Exit Sub
If CStr(vFilename) = "" Then Exit Sub
If Dir(CStr(vFilename)) <> "" Then
ActiveSheet.Pictures.Insert CStr(vFilename)
End If
End Sub

traveler7739
02-04-2011, 12:56 AM
Thank you for your reply. I appreciate your time and effort. I'm sorry I haven't thanked you before now. I just found your reply.
Thank you again!!