I recorded a macro that will change the text on the button to show the current date. The worksheet is not protected. When I shared the Workbook, and click on the button, I get this error:
Run-time error '-2147024809 (80070057)':
Requested Shapes are locked for selection
I uncheck the "Lock" and "Lock Text" (when I right click on the button and click "Format Control" and under "Protection" tab), but it didn't resolve the issue.
Does anyone know a workaround for this? I want the macro to work while it is being shared. Thank you.
Here is the code I got when I recorded the macro:
Sub updateDate()
'
' updateDate Macro
'
'
ActiveSheet.Shapes.Range(Array("Button 1")).Select
Selection.Characters.Text = Date
With Selection.Characters(Start:=1, Length:=9).Font
.Name = "Calibri"
.FontStyle = "Bold"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 3
End With
Range("B1").Select
End Sub
You cannot access some Objects/Class when you had it Shared/Protected. But what your goal is can be achieved, you don't have to change the Fonts once it is done (bare in mind that this Sub should only be called when the ActiveSheet had this button):
EDIT
To change Shapes when it is Shared, you first need to UnShare it, make changes and then Save it SharedAccess.
Try add another button and assign it to
MakeButtonRedBold
:I got same error when trying to view png files in vb6.0 sp6 win10-64bit. Maybe you could use it.
Short answer: On Error Resume Next
All code that showed a png file, i found out yesterday.
Changed to Image1.image on Form1 because properties: Stretch = True
Private Sub Form_Load()
' To make this work
' In Menu Project/References [x] Microsoft Windows Image Acquisition Library V2.0
' C:\WINDOWS\System32\wiaaut.dll
' http://www.vbforums.com/showthread.php?813811-How-to-load-PNG-image
' Make png-support.exe DID WORK if added line below
On Error Resume Next ' Get rid of error: vb6 runtime error-2147024809
Dim img As New WIA.ImageFile
img.LoadFile "c:\temp\test.png" ' ok filetypes png jpg gif tif
Set Image1 = img.FileData.Picture
Set img = Nothing
End Sub