ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert Pic Which User Chooses into Comment (https://www.excelbanter.com/excel-programming/388211-insert-pic-user-chooses-into-comment.html)

Bull

Insert Pic Which User Chooses into Comment
 
I have this code...but I need to edit this code so the Insert Picture
Dialog box comes up and the user finds the picture...not how it
currently reads...this would automatically put a picture in without a
users choice....

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 4/26/2007
'

'
Range("O3").Select
Range("O3").AddComment
Range("O3").Comment.Visible = False
Range("O3").Comment.Text Text:="meps2_spokane:" & Chr(10) & ""
Selection.ShapeRange.Line.Weight = 0.75
Selection.ShapeRange.Line.DashStyle = msoLineSolid
Selection.ShapeRange.Line.Style = msoLineSingle
Selection.ShapeRange.Line.Transparency = 0#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 0)
Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
Selection.ShapeRange.Fill.Visible = msoTrue
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 255, 255)
Selection.ShapeRange.Fill.BackColor.SchemeColor = 80
Selection.ShapeRange.Fill.Transparency = 0#
Selection.ShapeRange.Fill.UserPicture "C:\Galleries\Main Gallery
\Pict0225.JPG" *****Here is where I need the user to choose, not
this pic????********
Selection.ShapeRange.ScaleWidth 0.29, msoFalse,
msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 0.47, msoFalse,
msoScaleFromTopLeft
End Sub

Any help is appreciated, thank you.
Bull


Tom Ogilvy

Insert Pic Which User Chooses into Comment
 
fname = Application.GetOpenFilename()
Selection.ShapeRange.Fill.UserPicture fName

see help on GetOpenFilename for addtional arguments
also you can add some if statements to test what the user has chosen before
you try to use it with the UserPicture command.

--
Regards,
Tom Ogilvy


"Bull" wrote:

I have this code...but I need to edit this code so the Insert Picture
Dialog box comes up and the user finds the picture...not how it
currently reads...this would automatically put a picture in without a
users choice....

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 4/26/2007
'

'
Range("O3").Select
Range("O3").AddComment
Range("O3").Comment.Visible = False
Range("O3").Comment.Text Text:="meps2_spokane:" & Chr(10) & ""
Selection.ShapeRange.Line.Weight = 0.75
Selection.ShapeRange.Line.DashStyle = msoLineSolid
Selection.ShapeRange.Line.Style = msoLineSingle
Selection.ShapeRange.Line.Transparency = 0#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 0)
Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
Selection.ShapeRange.Fill.Visible = msoTrue
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 255, 255)
Selection.ShapeRange.Fill.BackColor.SchemeColor = 80
Selection.ShapeRange.Fill.Transparency = 0#
Selection.ShapeRange.Fill.UserPicture "C:\Galleries\Main Gallery
\Pict0225.JPG" *****Here is where I need the user to choose, not
this pic????********
Selection.ShapeRange.ScaleWidth 0.29, msoFalse,
msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 0.47, msoFalse,
msoScaleFromTopLeft
End Sub

Any help is appreciated, thank you.
Bull




All times are GMT +1. The time now is 07:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com