ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   Why doesnt this work (https://www.excelbanter.com/new-users-excel/178502-why-doesnt-work.html)

steve

Why doesnt this work
 
Dear All,

Can you have a look at this and please tell why it doesnt work




Sub CopySheetAsHTML()

Dim fName As String
Dim wks As Worksheet

Set wks = ActiveSheet
fName = wks.Range("J4").Value

With ActiveWorkbook.PublishObjects.Add(xlSourceSheet, _
"I:\" & fName & ".htm", wks.Name, "DataRange", _
xlHtmlStatic, wks.Range("J4").Value)
.Publish (True)
End With
End Sub




Many Thanks in advance



Steve

JP[_4_]

Why doesnt this work
 
Where to start?

1. Do you have this code in a standard Excel module?
2. Do you have a worksheet (not a chart sheet) activated? If so, is
there anything in cell J4? If so, what?
3. Do you have an I: drive?
4. Is the workbook saved?
5. Is "DataRange" referring to anything?


HTH,
JP

On Mar 2, 7:11*pm, steve wrote:
Dear All,

Can you have a look at this and please tell why it doesnt work

Sub CopySheetAsHTML()

Dim fName As String
Dim wks As Worksheet

Set wks = ActiveSheet
fName = wks.Range("J4").Value

With ActiveWorkbook.PublishObjects.Add(xlSourceSheet, _
* * "I:\" & fName & ".htm", wks.Name, "DataRange", _
* * * * xlHtmlStatic, wks.Range("J4").Value)
* * .Publish (True)
End With
End Sub

Many Thanks in advance

Steve




All times are GMT +1. The time now is 03:38 AM.

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