diff --git a/CHANGELOG.md b/CHANGELOG.md index 35c8075..af5d16c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,56 +8,59 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### [Unreleased] -... +#### Added +- Hidden rows and columns now are **NOT** exported by default; checkboxes + to enable export of hidden cells (per row and/or per-column) are + now provided ### [1.1.0] - 2019-01-08 #### Added - * New information box on the form indicates the sheet and range of - cells currently set to be exported - * New warning added, if the separator appears in the data to be exported; - this should minimize accidental generation of files that cannot be - used subsequently, due to the excess separator characters +- New information box on the form indicates the sheet and range of + cells currently set to be exported +- New warning added, if the separator appears in the data to be exported; + this should minimize accidental generation of files that cannot be + used subsequently, due to the excess separator characters #### Changed - * UserForm now reappears in its prior location when closed - and re-opened, instead of always reappearing in the center - of the Excel window. - * Selection of multiple areas now results in an "" - message in the new information box; and, greying out of the 'Export' - button instead of a warning message after clicking 'Export' - * Selection of entire rows/columns now sets for export the intersection - of the selection and the UsedRange of the worksheet. Selection of an - entire row/column outside the UsedRange of the worksheet gives an - "" message in the new information box and disables - the 'Export' button +- UserForm now reappears in its prior location when closed + and re-opened, instead of always reappearing in the center + of the Excel window +- Selection of multiple areas now results in an "" + message in the new information box; and, greying out of the 'Export' + button instead of a warning message after clicking 'Export' +- Selection of entire rows/columns now sets for export the intersection + of the selection and the UsedRange of the worksheet; selection of an + entire row/column outside the UsedRange of the worksheet gives an + "" message in the new information box and disables + the 'Export' button #### Fixed - * Userform now disappears when a chart-sheet is selected, and reappears - when a worksheet is re-selected. Userform will silently refuse to open - if triggered when a chart-sheet is active - * Error handling added around folder selection and output file opening - for write/append +- Userform now disappears when a chart-sheet is selected, and reappears + when a worksheet is re-selected; Userform will silently refuse to open + if triggered when a chart-sheet is active +- Error handling added around folder selection and output file opening + for write/append ### [1.0.0] - 2016-01-30 *Initial release* #### Features - * Folder selection works - * Name, number format, and separator entry work - * Append vs overwrite works - * Modeless form retains folder/filename/format/separator/etc. within a given Excel instance +- Folder selection works +- Name, number format, and separator entry work +- Append vs overwrite works +- Modeless form retains folder/filename/format/separator/etc. within a given Excel instance #### Limitations - * Exports only a single contiguous range at a time +- Exports only a single contiguous range at a time #### Internals - * Modest validity checking implemented for filename - * Red text and disabled `Export` button on invalid filename - * No validity checking implemented for number format - * Disabled `Export` button if number format or separator are empty +- Modest validity checking implemented for filename + - Red text and disabled `Export` button on invalid filename +- No validity checking implemented for number format +- Disabled `Export` button if number format or separator are empty diff --git a/src/UFExporter.frm b/src/UFExporter.frm index 73a21e5..7caeb2e 100644 --- a/src/UFExporter.frm +++ b/src/UFExporter.frm @@ -1,7 +1,7 @@ VERSION 5.00 Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} UFExporter Caption = "Export Data Range" - ClientHeight = 4080 + ClientHeight = 4770 ClientLeft = 45 ClientTop = 375 ClientWidth = 4560 @@ -386,31 +386,37 @@ Private Sub writeCSV(dataRg As Range, tStrm As TextStream, nFormat As String, _ ' Loop For idxRow = 1 To dataRg.Rows.Count - ' Reset the working string - workStr = "" - - For idxCol = 1 To dataRg.Columns.Count - ' Tag on the value and a separator - workStr = workStr & Format(dataRg.Cells(idxRow, idxCol).Value, nFormat) - workStr = workStr & Separator - Next idxCol - - ' Cull the trailing separator - workStr = Left(workStr, Len(workStr) - Len(Separator)) - - ' Write the line, with error-handling - On Error Resume Next - tStrm.WriteLine workStr - errNum = Err.Number: Err.Clear: On Error GoTo 0 - - If errNum <> 0 Then - MsgBox "Unknown error occurred while writing data line", _ - vbOKOnly + vbCritical, _ - "Error" + ' Only output visible rows unless hidden output indicated + If ChBxHiddenRows.Value Or Not dataRg.Cells(idxRow, 1).EntireRow.Hidden Then + ' Reset the working string + workStr = "" - Exit Sub + For idxCol = 1 To dataRg.Columns.Count + ' Tag on the value and a separator, but only if + ' visible or if hidden output indicated + If ChBxHiddenCols.Value Or _ + Not dataRg.Cells(idxRow, idxCol).EntireColumn.Hidden Then + workStr = workStr & Format(dataRg.Cells(idxRow, idxCol).Value, nFormat) + workStr = workStr & Separator + End If + Next idxCol + + ' Cull the trailing separator + workStr = Left(workStr, Len(workStr) - Len(Separator)) + + ' Write the line, with error-handling + On Error Resume Next + tStrm.WriteLine workStr + errNum = Err.Number: Err.Clear: On Error GoTo 0 + + If errNum <> 0 Then + MsgBox "Unknown error occurred while writing data line", _ + vbOKOnly + vbCritical, _ + "Error" + + Exit Sub + End If End If - Next idxRow End Sub diff --git a/src/UFExporter.frx b/src/UFExporter.frx index 6631d68..2970e50 100644 Binary files a/src/UFExporter.frx and b/src/UFExporter.frx differ