ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   PublishoOjects error '1004' trying to publish web page through cod (https://www.excelbanter.com/excel-programming/356979-publishoojects-error-1004-trying-publish-web-page-through-cod.html)

Andrew Stokes

PublishoOjects error '1004' trying to publish web page through cod
 
Hi Folks

I'm trying to add some code to an Excel workbook to publsih workseets as
webpages. I know this is possible using the autorepublish when the workbook
is saved but I want to republsih these items on demand.

The code I'm using is:
---------
Dim myInt, I as Integer
Set objPOjs = ActiveWorkbook.PublishObjects
myInt = objPOjs.Count

For I= t to myInt
ActiveWorkbook.PublishObjects.Item(I).Publish
Next I
-----------

I've also tried

---------
Set obj = ActiveWorkbook.PublishObjects
For each objPO in objPObjs
If objPo.HtmlType = xlHTMLStatic Then
objPO.Publish
End If
Next objPO
--------

I get no complaint when there are no objects to publish but as soon as I
select areas and publish them as webpages then run the code it crashes saying:

Run-time error '1004':

Method 'Publish' of object 'PublishObject' failed

Any ideas?

Thanks

Andy



All times are GMT +1. The time now is 05:29 PM.

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