Using VBA to change Picture

后端 未结 10 1026
庸人自扰
庸人自扰 2020-12-10 12:41

I am trying to use VBA to automate the Change Picture function when you right click a Shape in Excel/Word/Powerpoint.

However, I am not able to find any reference, c

10条回答
  •  不知归路
    2020-12-10 12:54

    what I do is lay both images on top of eachother, and assign the macro below to both images. Obviously i've named the images "lighton" and "lightoff", so make sure you change that to your images.

    Sub lightonoff()
    
    If ActiveSheet.Shapes.Range(Array("lighton")).Visible = False Then
        ActiveSheet.Shapes.Range(Array("lighton")).Visible = True
            Else
        ActiveSheet.Shapes.Range(Array("lighton")).Visible = False
        End If
    
    End Sub
    

提交回复
热议问题