PDA

View Full Version : Specify Columns for HTML export



sanderson
12-10-2013, 10:18 AM
I can export this no problem...

With ActiveWorkbook.PublishObjects.Add(xlSourceRange, website_path _
, "CCR LOG", "$A:$AA", xlHtmlStatic, "CCR_log_24100", "")
.Publish (True)
.AutoRepublish = False
End With


Is there a way to do this?

With ActiveWorkbook.PublishObjects.Add(xlSourceRange, website_path _
, "CCR LOG", "$A:$H;$J;$T:$AA", xlHtmlStatic, "CCR_log_24100", "")
.Publish (True)
.AutoRepublish = False
End With
Basically, I would like to specify columns that are not necessarily sequential.

Thank you for any help you can provide.

sassora
12-11-2013, 04:13 PM
Presumably, you can use Union() here?

Union(Range("$A:$H"), Range("$J:$J"),Range("$T:$AA"))

in place of "$A:$H;$J;$T:$AA"

Perhaps the existing style is useable if slightly adapted:

"$A:$H,$J:$J,$T:$AA"?

sanderson
12-12-2013, 04:07 PM
In VB Code?

' With ActiveWorkbook.PublishObjects.Add(xlSourceRange, website_path _
, "CCR LOG", Union(Range("$A:$H"), Range("$J:$J"), Range("$T:$AA")), xlHtmlStatic, "CCR_log_24100", "")

Or some other way?

Thanks...

sassora
12-12-2013, 05:21 PM
These are educated guesses, so yes

' With ActiveWorkbook.PublishObjects.Add(xlSourceRange, website_path _
, "CCR LOG", Union(Range("$A:$H"), Range("$J:$J"), Range("$T:$AA")), xlHtmlStatic, "CCR_log_24100", "")

OR

' With ActiveWorkbook.PublishObjects.Add(xlSourceRange, website_path _
, "CCR LOG", "$A:$H,$J:$J,$T:$AA", xlHtmlStatic, "CCR_log_24100", "")

sanderson
12-13-2013, 08:47 AM
Continues to produce error 1004!

sassora
12-13-2013, 12:56 PM
It looks like you may have to quote a contiguous range, like "A:AA"

http://answers.microsoft.com/en-us/office/forum/office_2007-customize/publishobjects-multiple-range-of-a-worksheet/8a2a13f0-e04d-4f46-818f-bb5e7f959231