ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Please help debug this macro. (https://www.excelbanter.com/excel-programming/381496-please-help-debug-macro.html)

dd

Please help debug this macro.
 
I'm trying to set up a macro to save the selected print area as a single
file web page, but I get an error at .Publish (True) "Runtime error 1004
Application-defined or object-defined error."

Private Sub cmdSave_Click()
With ActiveWorkbook.PublishObjects.Add(xlSourcePrintAre a, _
"P:\GBGWA\Rail\Jobs\5048337 OPI06\Surveys\Index of Proforma
Files.mht", "List1" _
, "", xlHtmlStatic, "Proforma Index (pfm files)_27036", "")
.Publish (True)
.AutoRepublish = False
End With


End Sub

D Dawson



NickHK

Please help debug this macro.
 
You are not using the return value (there is not one in fact, as it's a sub)
nor evaluating the argument (true).
So you do not require the brackets:
..Publish True

NickHK

"dd" <dd.dd wrote in message
...
I'm trying to set up a macro to save the selected print area as a single
file web page, but I get an error at .Publish (True) "Runtime error 1004
Application-defined or object-defined error."

Private Sub cmdSave_Click()
With ActiveWorkbook.PublishObjects.Add(xlSourcePrintAre a, _
"P:\GBGWA\Rail\Jobs\5048337 OPI06\Surveys\Index of Proforma
Files.mht", "List1" _
, "", xlHtmlStatic, "Proforma Index (pfm files)_27036", "")
.Publish (True)
.AutoRepublish = False
End With


End Sub

D Dawson





dd

Please help debug this macro.
 
Nick

I tried this and still get runtime error 1004, Method 'Publish' of object
'PublishObject' failed.
I've tried using your instruction with both True and False and there's no
difference. I notice when I mouseover the highlighted line it states
"True=True" or "Fasle=False".

Private Sub cmdSave_Click()
With ActiveWorkbook.PublishObjects("Proforma Index (pfm files)_27036")
.Publish True
.AutoRepublish = False
End With
End Sub

Dylan

"NickHK" wrote in message
...
You are not using the return value (there is not one in fact, as it's a sub)
nor evaluating the argument (true).
So you do not require the brackets:
..Publish True

NickHK

"dd" <dd.dd wrote in message
...
I'm trying to set up a macro to save the selected print area as a single
file web page, but I get an error at .Publish (True) "Runtime error 1004
Application-defined or object-defined error."

Private Sub cmdSave_Click()
With ActiveWorkbook.PublishObjects.Add(xlSourcePrintAre a, _
"P:\GBGWA\Rail\Jobs\5048337 OPI06\Surveys\Index of Proforma
Files.mht", "List1" _
, "", xlHtmlStatic, "Proforma Index (pfm files)_27036", "")
.Publish (True)
.AutoRepublish = False
End With


End Sub

D Dawson







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

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