bskinn / excel-csvexporter

Lightweight tool to export ranges within an Excel sheet to CSV
MIT License
41 stars 7 forks source link

Initial header implementation breaks if entire rows/columns selected with header rows option active #25

Closed bskinn closed 4 years ago

bskinn commented 4 years ago

In particular, an error is raised when the header output is enabled and an entire row or column is selected that does not intersect .UsedRange.

getHeaderRange returns Nothing if called when an invalid selection has been made, because ExportRange gets set to Nothing.

Should probably be sufficient to avoid this by modifying getHeaderRangeAddress to LBLY and pre-fetch getHeaderRange and do a Nothing check on it before attempting the .Address(...) lookup.

Or, could EAFP by catching the RTE 91. Can't be sure it'll always be the same RTE on different Office versions/platforms, though -- kind of prefer the LBLY here.