Reputation: 318
I have a workbook which works with lots of VBA and a custom add-in to create reports for customers. The workbook has a series of buttons on the front sheet, which control the operation of the report "app":
This is mostly deployed on Surface Pro 3s and 4s. One of the users reports that any time they click a button, it becomes pixellated (pictured below) and can no longer be read. I haven't seen this on other units, and it may be relevant that this user has an external display which duplicates what is on his Surface screen. The effect happens on both screens:
The office version is Excel 2016 MSO 32-bit.
Has anyone seen this and does anyone know why it happens?
Upvotes: 1
Views: 255
Reputation: 318
I eventually solved this problem by replacing all of the buttons with Rectangle Shapes. These can still have macros assigned and even turn the cursor to a hand when the user hovers over them.
I think that the pixellation problem is peculiar to embedded ActiveX controls on worksheets, and it can be avoided by using other tools when possible. I don't think there's any other way!
To reimplement buttons as shapes, I wrote a ShapeButtons module (in VBA side) with some helpful functions for showing/hiding buttons and getting/setting text. All of the buttons in our worksheet are on a page called ControlSheet
. Please excuse my highly defensive error handling:
Public Sub SetShapeBtnText(name As String, newText As String)
On Error GoTo errorHandler
Dim btn As Shape
Set btn = GetShapeBtn(name)
btn.TextFrame2.TextRange.text = newText
Exit Sub
errorHandler:
WriteDebugError ("SetShapeBtnText Exception for " & name & " with " & newText)
End Sub
Public Sub ShowShapeBtn(name As String)
On Error GoTo errorHandler
ControlSheet.Shapes(name).Visible = True
Exit Sub
errorHandler:
WriteDebugError ("ShowShapeBtn Exception for " & name)
End Sub
Public Sub HideShapeBtn(name As String)
On Error GoTo errorHandler
ControlSheet.Shapes(name).Visible = False
Exit Sub
errorHandler:
WriteDebugError ("HideShapeBtn Exception for " & name)
End Sub
Public Function ShapeBtnIsVisible(name As String) As Boolean
On Error GoTo errorHandler
ShapeBtnIsVisible = ControlSheet.Shapes(name).Visible
Exit Function
errorHandler:
WriteDebugError ("ShapeBtnIsVisible Exception for " & name)
End Function
Upvotes: 0