Excel 2016 issue saving to HTML format

pbassett

Active Member
Joined
May 5, 2004
Messages
358
With Excel 2010 I had no problem populating and saving a Word template of a metric comprised of various charts, shapes, tables etc. to a .png file. This facility's monitors require image files and they were essentially a screen shot of the document.
But when I upgraded to Office 2016 this week the image file is a disaster! The charts are missing and the tables overlap. It contains barely 1/3 of the previous content and so is completely unusable.

The code saves the Word document as HTML which creates a folder with several files, the largest of which is my .png image file.

Code:
    ' Save in HTML format
    wdapp.ActiveDocument.SaveAs2 Filename:=strBasePath & "..\Metric Sheets.html", FileFormat:=wdFormatHTML
    On Error Resume Next
    strFullPath = strBasePath & "..\Metric Sheets_files\"
    strExt = ".png"
    Dim fso As Object
    Set fso = CreateObject("Scripting.FileSystemObject")
    For x = 0 To UBound(arrCaptions)
        strImageName = Replace(LargestImage(strFullPath), ":", "-")
        destFile = strBasePath & strFolderName & "\" & imageName & strExt
        If fso.FileExists(destFile) = True Then
            fso.DeleteFile destFile
        End If
        fso.CopyFile Source:=strFullPath & strImageName, Destination:=destFile
    Next
    Kill strFullPath & "*.*"
    fso.DeleteFolder strBasePath & "..\Metric Sheets_files"
    Set fso = Nothing

Clearly the functionality of SaveAs2 to the format wdFormatHTML has radically changed. Does anyone know how to recover the previous functionality? I don't see why this changed so radically.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Try recording a macro in Word and check that it does it properly, manually first.

You could try modifying some of the options. e.g.
Code:
SaveNativePictureFormat:=True
 
Last edited:
Upvote 0
No change after adding that option, but there is a Word Compatibility Checker message:

"Some of the features in this document aren't supported by Web browsers.

Summary
Tables with test wrapping and framed objects will become aligned with the beginning of the paragraph. (7 Occurrences)
Text in the left margin will move to the right. (1 Occurrence)"
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,314
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top