Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Why doesnt this work

Dear All,

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

File Path is correct



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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default Why doesnt this work

Hi
Try
Dim myobject As PublishObject
Set myobject = ActiveWorkbook.PublishObjects.Add(xlSourceSheet, _
"I:\" & fName & ".htm", wks.Name, "DataRange", _
xlHtmlStatic, wks.Range("J4").Value)

myobject.Publish

You only apply brackets round the variables for the Add method when it
is combined with a Set ... = as above. Without the Set you leave out
the brackets

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

This syntax does not allow you to do .Publish though.
regards
Paul

On Mar 3, 11:29*am, steve wrote:
Dear All,

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

File Path is correct

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


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
Why doesnt this work? MurrayBarn Excel Worksheet Functions 2 November 19th 09 04:21 PM
Why doesnt shortcut key work on some but not on others? Craig Excel Discussion (Misc queries) 3 August 12th 08 03:20 PM
Why doesnt this work steve New Users to Excel 1 March 3rd 08 04:52 PM
Why doesnt this work? [email protected] Excel Programming 4 February 10th 08 03:29 AM
TAB Key doesnt work. Murat D. Hekimošlu Excel Programming 1 January 25th 05 10:48 AM


All times are GMT +1. The time now is 01:44 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"