Save this web page with value of the active cell in sheet2

D

DaveM

Hi

Sub SaveTempletAsWebpage()

Range("A5:Q70").Select
With ActiveWorkbook.PublishObjects.Add(xlSourceRange, _
"C:\Test\Page.htm" _
, "sheet1", "$A$5:$Q$70", xlHtmlStatic, "Book1_16704", "" _
)
.Publish (True)
.AutoRepublish = False
End With
ChDir _
"C:\Test"
End Sub

I would like to save this web page with value of the active cell in sheet2
which is B1

Thanks in advance

Dave
 
T

Tim Williams

Untested:

With ActiveWorkbook.PublishObjects.Add(xlSourceRange, _
"C:\Test\" & Sheet2.Range("B1").Value, _
"sheet1", "$A$5:$Q$70", xlHtmlStatic, "Book1_16704", "")

I'm using the sheet2 codename - if you want to use the tab name it would be
Activeworkbook.sheets("Sheet2").Range("B1").value

Tim
 
D

DaveM

Thanks Tim

Works a treat

All the best

Dave


Tim Williams said:
Untested:

With ActiveWorkbook.PublishObjects.Add(xlSourceRange, _
"C:\Test\" & Sheet2.Range("B1").Value, _
"sheet1", "$A$5:$Q$70", xlHtmlStatic, "Book1_16704", "")

I'm using the sheet2 codename - if you want to use the tab name it would
be
Activeworkbook.sheets("Sheet2").Range("B1").value

Tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top