The below code was typed for export the worksheet into a html. However, I would like to set a specific html code for it. Is it possible to do so in VBA?
Many thanks
Kinny
Many thanks
Kinny
Code:
Private Sub CommandButton2_Click()
Dim str, myfolder, myfile, fName As String
str = "Do you want to save these sheets to a single html file?" & Chr(10)
answer = MsgBox(str, vbYesNo, "Continue with save?")
If answer = vbNo Then Exit Sub
With Application.FileDialog(msoFileDialogFolderPicker)
.Show
myfolder = .SelectedItems(1) & "\"
End With
myfile = InputBox("Enter filename", "Save as..")
If myfile = "" Then Exit Sub
ThisWorkbook.Sheets("Risk").range("A1:BF113").Select
With ActiveWorkbook.PublishObjects.Add(xlSourceRange, _
Filename:=myfolder & myfile & ".htm", Sheet:="Risk", Source:="A1:BF113", _
HtmlType:=xlHtmlStatic)
.Publish (True)
.AutoRepublish = False
End With
End Sub
Last edited: