My work around is to programmatically iterate through all OLE objects on the sheet* and write code to the debugger, then include a button basically "resize objects" on the sheet - with instructions on why this problem is occurring.
This method will generate the code to drive that button.
It will not automatically update however - it is a snapshot and should only be used immediately prior to deployment of an app (if end users are going to have the button functionality).
The sequence then becomes:
- Run code generated with following method
- Save workbook immediately - this does NOT prevent the font changes from continuing to occur
- Reopen workbook and problem is "solved"
Private Sub printAllActiveXSizeInformation()
Dim myWS As Worksheet
Dim OLEobj As OLEObject
Dim obName As String
Dim shName As String
'you could easily set a for/each loop for all worksheets
Set myWS = Sheet1
shName = myWS.name
Dim mFile As String
mFile = "C:UsersyouDesktopActiveXInfo.txt"
Open mFile For Output As #1
With myWS
For Each OLEobj In myWS.OLEObjects
obName = OLEobj.name
Print #1, "'" + obName
Print #1, shName + "." + obName + ".Left=" + CStr(OLEobj.Left)
Print #1, shName + "." + obName + ".Width=" + CStr(OLEobj.Width)
Print #1, shName + "." + obName + ".Height=" + CStr(OLEobj.Height)
Print #1, shName + "." + obName + ".Top=" + CStr(OLEobj.Top)
Print #1, "ActiveSheet.Shapes(""" + obName + """).ScaleHeight 1.25, msoFalse, msoScaleFromTopLeft"
Print #1, "ActiveSheet.Shapes(""" + obName + """).ScaleHeight 0.8, msoFalse, msoScaleFromTopLeft"
Next OLEobj
End With
Close #1
Shell "NotePad " + mFile
End Sub
*note: this will not find objects which are grouped, unfortunately, either.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…