View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default PLEASE CAN ANYBODY CORRECT THIS MACRO

Give this a try (untested)

Sub SAV()
Dim SH As Sheets
Dim NA As Range
set SH = ActiveSheet
set NA = Range("H2")
Range("A2:F23").Select
With ActiveWorkbook.PublishObjects.Add(xlSourceRange, _
"C:\Documents and Settings\kamranr\My Documents\" & NA.value &
".htm", _
SH, "$A$2:$F$23", xlHtmlStatic, , "")
.Publish (True)
.AutoRepublish = False
End With
Range("A2").Select
End Sub

--
HTH...

Jim Thomlinson


"K" wrote:

Hi all, I got excel 2007 and I am trying to Save As Range ("A2:F23")
as Web Page file format. I have done it but I want sheet to be
Activesheet and file name to be Range("H2") for which I done the macro
below but its giving error. Can any friend can help me in this i'll be
very thankful to him.

Sub SAV()
Dim SH As Sheets
Dim NA As Range
SH = ActiveSheet
NA = Range("H2").Value
Range("A2:F23").Select
With ActiveWorkbook.PublishObjects.Add(xlSourceRange, _
"C:\Documents and Settings\kamranr\My Documents\NA.htm", SH, _
"$A$2:$F$23", xlHtmlStatic, , "")
.Publish (True)
.AutoRepublish = False
End With
Range("A2").Select
End Sub