Please help debug this macro.

D

dd

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(xlSourcePrintArea, _
"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
 
N

NickHK

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
 
D

dd

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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top