VBA Code for Excel 2016 to make attached picture lighter and darker and change it to grayscale.

Hello Experts
I have to add VBA Code for Excel 2016 to make attached picture lighter and darker and change it to grayscale.

 code.xlsm
NickAsked:
Who is Participating?
 
Subodh Tiwari (Neeraj)Connect With a Mentor Excel & VBA ExpertCommented:
You may try this code for the button Change Color To Grayscale.
Private Sub CommandButton4_click()
Dim Shp As Shape, Pic As Shape

For Each Shp In ActiveSheet.Shapes
    If Shp.Type = msoPicture Then
        Set Pic = Shp
        Exit For
    End If
Next Shp

If Not Pic Is Nothing Then
    With Pic.PictureFormat
        .IncrementBrightness 0.2    'Increases the Brightness by 20%
        .IncrementContrast 0.1      'Increases the Contrast by 10%
        .ColorType = msoPictureGrayscale
    End With
End If
End Sub

Open in new window

0
 
NickAuthor Commented:
Hi Subodh,
thank you for the code. It works!... The only thing I need a better way to control brightness, scroll bar would be the best option. is it doable?

Thank You
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.