Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 557
Default PLEASE CAN ANYBODY CORRECT THIS MACRO

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 557
Default PLEASE CAN ANYBODY CORRECT THIS MACRO

On 2 Jun, 17:18, Jim Thomlinson <James_Thomlin...@owfg-Re-Move-
This-.com wrote:
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- Hide quoted text -


- Show quoted text -


Thanks for replying jim. in macro below i have solved my problem the
only thing left that how can i change Sheet1 to Activesheet. I did
try doing different thing but i am getting error message. Any
suggestions

Sub SAV()

Range("A2:F23").Select
With ActiveWorkbook.PublishObjects.Add(xlSourceRange, _
"C:\Documents and Settings\KAMRAN\My Documents\" &
Range("K1").Value & " - " & Range("H2").Value & ".htm", _
"Sheet1", "$A$2:$F$23", xlHtmlStatic, , "")
.Publish (True)
.AutoRepublish = False
End With
Range("A2").Select
End Sub
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Correct syntax for IF, Then in a macro Ken[_2_] Excel Worksheet Functions 5 June 21st 08 06:19 PM
PLEASE ANY BODY CAN CORRECT MY MACRO K[_2_] Excel Programming 1 March 20th 08 07:15 PM
Please help correct this macro! :) ninpo1 Excel Programming 2 August 8th 06 08:39 PM
Please correct my macro famdamly Excel Discussion (Misc queries) 5 March 5th 06 08:45 PM
this Macro is don't correct MS[_6_] Excel Programming 2 January 26th 06 07:28 AM


All times are GMT +1. The time now is 07:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"