ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Publishing a Range (https://www.excelbanter.com/excel-programming/415210-publishing-range.html)

akay26

Publishing a Range
 
I hope someone cvan help me. Below is some code that I am trying to get to
work but no luck.

Sub Pub_Chart_To_Web()
Dim myWebPage as Range
Sheets("Sheet1").Select
Set myWebpage = Range("Part3").Value
Sheets("Chart").Select
Application.Run "A_ChartLinks_FormatFix"
Range("Chart_PubToWeb").Select
With ActiveWorkBook.PublishObjects.Add( _
SourceType:=xlSourceRange, _
Filename:=myWebpage, _
Sheet:="Chart", _
Source:="Chart_PubToWeb", _
HtmlType:=xlHtmlStatic).Publish(True)
End With
End Sub

Part3 is a named range on Sheet1 = "\\mchomek\shane\newchart.mht" (with
quote mark).

The code above is giving me a expected function error with .Publish
highlighted.

Thanks,
Shane

Jim Thomlinson

Publishing a Range
 
Assuming that myWebpage is a range object then remove the .value from the
end...

Set myWebpage = Range("Part3")

--
HTH...

Jim Thomlinson


"akay26" wrote:

I hope someone cvan help me. Below is some code that I am trying to get to
work but no luck.

Sub Pub_Chart_To_Web()
Dim myWebPage as Range
Sheets("Sheet1").Select
Set myWebpage = Range("Part3").Value
Sheets("Chart").Select
Application.Run "A_ChartLinks_FormatFix"
Range("Chart_PubToWeb").Select
With ActiveWorkBook.PublishObjects.Add( _
SourceType:=xlSourceRange, _
Filename:=myWebpage, _
Sheet:="Chart", _
Source:="Chart_PubToWeb", _
HtmlType:=xlHtmlStatic).Publish(True)
End With
End Sub

Part3 is a named range on Sheet1 = "\\mchomek\shane\newchart.mht" (with
quote mark).

The code above is giving me a expected function error with .Publish
highlighted.

Thanks,
Shane



All times are GMT +1. The time now is 11:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com