cactus
01-11-2008, 07:43 AM
I have a problem. I want to publish several ranges in a sheet with this code:
-----------------------------------------------------------------------
For I = 5 To 34
Dim objpubl As PublishObject
If Sheets("PROD").Range(Range("DD" & I).Value).Value <> "(ALL)" Then
Set objpubl = Workbooks("prod.xls").PublishObjects.Add _
(SourceType:=xlSourceRange, _
Filename:="*webserver\" & Range(Range("DD" & I).Value).Value & ".htm", _
Sheet:="PROD", _
Source:=Range(Range("DD" & I).Value).Offset(0, -1) & ":" & Range(Range("DD" & I).Value).Offset(27, 18), _
HtmlType:=xlHtmlStatic, _
DivID:="Sample")
objpubl.Publish
Else
End If
Next
-----------------------------------------------------------------------
but I have an "Application-defined or object-defined error". I think the trouble is in the source: I have the the range names in the column "DD"
Thanks in advance and sorry for my english.
Cactus.-
-----------------------------------------------------------------------
For I = 5 To 34
Dim objpubl As PublishObject
If Sheets("PROD").Range(Range("DD" & I).Value).Value <> "(ALL)" Then
Set objpubl = Workbooks("prod.xls").PublishObjects.Add _
(SourceType:=xlSourceRange, _
Filename:="*webserver\" & Range(Range("DD" & I).Value).Value & ".htm", _
Sheet:="PROD", _
Source:=Range(Range("DD" & I).Value).Offset(0, -1) & ":" & Range(Range("DD" & I).Value).Offset(27, 18), _
HtmlType:=xlHtmlStatic, _
DivID:="Sample")
objpubl.Publish
Else
End If
Next
-----------------------------------------------------------------------
but I have an "Application-defined or object-defined error". I think the trouble is in the source: I have the the range names in the column "DD"
Thanks in advance and sorry for my english.
Cactus.-