I am using Excel 2002 to create a Web page. My Excel workbook has a
number of sheets but I need to save each sheet as a web page. I have
created a macro and always get an Run-Time Error '1004'
Application-defined or object-defined error
on this line of code:
With ActiveWorkbook.PublishObjects.Add(xlSourceSheet,
"C:\Data\Public\Oracle FSG's\" & a$ & "\Test.htm", "Sheet1", "",
xlHtmlStatic, "Book2_9867", "")
.Publish (True)
.AutoRepublish = False
End With |
Request for Question Clarification by
mathtalk-ga
on
24 Feb 2003 08:52 PST
Hi, ash4317-ga:
I think I've had this kind of problem myself. It's difficult to
diagnose just looking at the immediate line where the error occurs,
but my guess is that to make the "With ... End With" syntax work, you
should create an "object" variable to how each sheet, then apply the
"With ... End With" syntax to that variable.
To elaborate on the problem slightly, the "object" which you are
apparently trying to "publish" appears to be the worksheet "added"
following the "With" keyword. Even when an expression returns an
object (which I haven't tried to verify here, since I lack your
setup), one sometimes cannot use that expression in the "With ... End
With" construct because the "return value" is seemingly discarded.
Let me know if you'd like me to post a more detailed version as an
answer.
regards, mathtalk
|