Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think that the problems you are getting with the security obstacles with activex is because you are embedding excel into a webpage. It should be posssible to print a worksheet by publishing the sheet as HTML using Excel's publish method. I use this to create an HTML for emails.</p> <pre><code>Dim rngeTableRange As Range Dim lsTableFileName As String lsTableFileName = &lt;filepath and name for HTML output as string&gt; Set rngeTableRange = ActiveSheet.UsedRange ActiveWorkbook.PublishObjects.Add(xlSourceRange, lsTableFileName, _ rngeTableRange.Parent.Name, rngeTableRange.Address, xlHtmlStatic).Publish True </code></pre> <p>If you want the printout to appear to be a spreadsheet you can add borders before publishing the worksheet. The following VBA code will put a border around each cell:</p> <pre><code>With ActiveSheet.UsedRange.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlThin End With With ActiveSheet.UsedRange.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlThin End With With ActiveSheet.UsedRange.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThin End With With ActiveSheet.UsedRange.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin End With With ActiveSheet.UsedRange.Borders(xlInsideVertical) .LineStyle = xlContinuous .Weight = xlThin End With With ActiveSheet.UsedRange.Borders(xlInsideHorizontal) .LineStyle = xlContinuous .Weight = xlThin End With </code></pre> <p>The result should be an HTML image of the spreadheet that dosn't lead to the security warnings and I would assume would be printable.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload