更新时间:2022-10-15 11:20:33
If you assign the picture in the Forms Designer the path is not stored as the image is subsequently loaded from storage within the workbook itself.
To persist the path you would load at runtime:
dim path As string
path = "C:\...\foo.jpg"
set commandbutton1.Picture = loadpicture(path)
You can then store the path in the buttons Tag
property:
commandbutton1.Tag = path
Then read it back when its clicked:
ActiveWorkbook.Sheets("UserQuestionnaire").Range("C4").Value = commandbutton1.Tag