[ACXFAQ023]
Microsoft Excel not updating ActiveX controls when printing!


Microsoft Excel doesn't always update the "Metafile-representation" of ActiveX components when outputting a sheet or workbook to a printer.  As a workaround, you can force Excel to update all OLE controls on all worksheets with the following code added to your workbook sheet...

Update all ActiveX Controls on All Worksheets

Private Sub Workbook_BeforePrint(Cancel As Boolean)
  Dim AWorksheet As Worksheet
  Dim AObject As OLEObject

  On Error Resume Next

  For Each AWorksheet In Worksheets
    For Each AObject In AWorksheet.OLEObjects
      AObject.Width = AObject.Width + 1
      AObject.Width = AObject.Width - 1
    Next AObject
  Next AWorksheet
End Sub

Update only Iocomp ActiveX Controls on All Worksheets

Private Sub Workbook_BeforePrint(Cancel As Boolean)
  Dim AWorksheet As Worksheet
  Dim AObject As OLEObject
  Dim AString As String

  On Error Resume Next

  For Each AWorksheet In Worksheets
    For Each AObject In AWorksheet.OLEObjects
      AString = Left$(AObject.progID, InStr(AObject.progID, ".") - 1)
      If (AString = "isAnalogLibrary") Or _
         (AString = "isDigitalLibrary") Or _
         (AString = "iProfessionalLibrary") Or _
         (AString = "iPlotLibrary") Or _
         (AString = "iStripChartXControl") Then
        AObject.Width = AObject.Width + 1
        AObject.Width = AObject.Width - 1
      End If
    Next AObject
  Next AWorksheet
End Sub


Copyright ©1998-2007 Iocomp Software Incorporated. Iocomp and the Iocomp Logo are registered trademarks of Iocomp Software Inc. All other trademarks are registered by their respective owners.