From 5832b3e7bd3ed2ea70210931c518ed7f50cfc0da Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Fri, 20 Sep 2019 12:55:17 -0400 Subject: [PATCH 1/3] Add option to export hidden rows or not --- src/UFExporter.frm | 50 +++++++++++++++++++++++---------------------- src/UFExporter.frx | Bin 4120 -> 4120 bytes 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/UFExporter.frm b/src/UFExporter.frm index 73a21e5..f82de97 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,33 @@ 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 + If ChBxOutputHidden.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 + 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" + + Exit Sub + End If End If - Next idxRow End Sub diff --git a/src/UFExporter.frx b/src/UFExporter.frx index 6631d680174a8116a5b01d9b8f61b866f68bf854..86565949b60f212949cc3369572ca210a77ba563 100644 GIT binary patch delta 943 zcmY*XKTH#G6n=O8!`<~-AT6ar508qG82pEZ)W!q>F$^RUU?5Q=)t-p9cZHVN1dWU) z4q$!@aU%{S#svpfbkso>O*iWQ{+`%M z+QGKjYgbe6ocB_Ih*p~L!gEu+iVcbn!K@nRFdoN^%!IPins^*qZcQU*yBQ)0zEv3E z(|R+$T44M2dR<%zr`rzTrvujM2MzXH3y-8O3ignqx9AM7*NG0p(|w{l2Z=tJVn8{j zG22TSuT@b}j-*}~fl-oE)QeCUT1RVTXR%5oo-3IoP@IAbAvIETDi*#u1+-Aq0T%2d zP~^%*r&zESbCd}ZZAxNaHN~D96A#r4?k73zQmG7_FIslKWaX$rufcs*bgPE=rcNk! z*9GOj!$mD4=SZw+NyHiJ6Tj6a{?W(Mr>vrN!+LfQ}x~l_mZvwN&vxe5M@H+6U z=L{@N?KE8*t~I(Oco~^oX^=aMrF^wy z?I1a)iywMNvZWJg9A6CrIZ~c?KZ)D@XNc0IgU|@yo|@ znXClzX&M&6GLPIEt__vTmR%tFf{AT6i;ZYUB1o+?T(!N)dOhnByV0yX78h#lcz+1< h;%+b{c7BETeijz@lMJ2VAqUP5=M^ From 21fc286ff8711fe20cf78586178c60deabe37d03 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Fri, 20 Sep 2019 13:02:24 -0400 Subject: [PATCH 2/3] Add option for export of hidden columns also Simple enough to do so. Defaults are NOT to output hidden rows/columns, because that is probably the least-surprising behavior---it matches what the user will see on their screen. --- src/UFExporter.frm | 14 +++++++++----- src/UFExporter.frx | Bin 4120 -> 4120 bytes 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/UFExporter.frm b/src/UFExporter.frm index f82de97..7caeb2e 100644 --- a/src/UFExporter.frm +++ b/src/UFExporter.frm @@ -386,15 +386,19 @@ Private Sub writeCSV(dataRg As Range, tStrm As TextStream, nFormat As String, _ ' Loop For idxRow = 1 To dataRg.Rows.Count - ' Only output visible rows - If ChBxOutputHidden.Value Or Not dataRg.Cells(idxRow, 1).EntireRow.Hidden Then + ' 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 = "" 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 + ' 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 diff --git a/src/UFExporter.frx b/src/UFExporter.frx index 86565949b60f212949cc3369572ca210a77ba563..2970e5059903cf9a5114b7e4cb49058c44df6b8c 100644 GIT binary patch delta 570 zcmbQCFhgNO3ybIn?Hh_$^RF^8GXMbxh+tqyo7~86KluiW1*7w1LDqW4HB|ZkoE8X|NoN{*i-~%fE-zsu0GE6`{6`cEkUU30pgjfuh5lCtR zml#uS;^Y-vWn%UWFq1$Q2B+qvCYNxh11(fi;ZA2@Qee;kTEYi+3olntVqSWx6$3*d z(B}KhAj=r-Cr{^&V+QJ<{DWJMl?$lNX7YJ1S$Te-HWzLNhH9X941mUXWTvE~<|#Pm z1O1s-Y(Kf5QySzNLl%+A5j>GhrMZ(g^XM`c0qMs)(Tu5+?Rm9;WEQU;b4hCIP=UzqLI_K$pbe^Z@EgNOydQYlNEX;=|0K0+`y+u5g z2605<_#_Rn8Vt(2>=;Y(cCeAAS#Jk`5e6~r8|Gh*<5W|H3138Zi|}p9x6ev84}uf{ zt_IWqjU5M|6+5`8R8e&&P&&d@-X6LMixVJ(AWAJC$(Sgvwk?~)I=x(K7F`ukjV zca4CQ+LO6V+S)LoSpqm?c<49q&9CEu|B7du#`(WyMrjsIz+O!W*8oY{;Nb&W|G+@%M6R_#QP$8R40{j5ds2!RQ52F4C}?RIw$ND@LlcpM7L;h z2DqzrvQ@m$dc5AV)=oW9?-VvIj1iESxZcm2@JLS$!o3V2*N`&kf>-jFT(e#05)?W# kz}WI=ak`LSE99qE(rGK3q@B-tB9CFY%EoIc`Wy6n-@@;4!T Date: Fri, 20 Sep 2019 13:21:17 -0400 Subject: [PATCH 3/3] Update CHANGELOG --- CHANGELOG.md | 65 +++++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 31 deletions(-) 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