With help from the lounge I developed a macro that will go to a named range in a workbook and export it as a (non-interactive) HTML file to my desktop. The code is below. What I am wondering is, if I can get Excel to go to the named range “Grades”, why does it need the string “Grades_2005_Summer-1_1258” in the next line. That string is the name of the file with the _1258 appended – but I am not sure why.
So, what I am wondering is:
1) How do I generalize this code to work with other files? Currently, if I delete the reference to the file name, the macro fails.
2) What is the purpose of the (false) after publish. Does this have to do with interactivity?
Dim strMyDocs As String
strMyDocs = CreateObject(“WScript.Shell”).SpecialFolders(“Desktop”)
‘
Application.Goto Reference:=”Grades”
With ActiveWorkbook.PublishObjects(“Grades_2005_Summer-1_1258”)
.HtmlType = xlHtmlStatic
‘.Filename = “C:Documents and SettingsSUUDesktopPage.htm”
.Filename = strMyDocs & “page.htm”
.Publish (False)
.AutoRepublish = False
End With