From b8aa429e657aa0ab1e835e0d8ad18f63585271c3 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Fri, 7 Feb 2020 10:36:16 -0500 Subject: [PATCH 1/2] Implement initial fix to #25 Appears to correctly address the problem leading to RTE 91 when the header option was enabled and an entire row/column was selected that did not intersect .UsedRange Closes #25. --- src/UFExporter.frm | 6 +++++- src/UFExporter.frx | Bin 4632 -> 4632 bytes 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/UFExporter.frm b/src/UFExporter.frm index ee32b1f..8d5b29e 100644 --- a/src/UFExporter.frm +++ b/src/UFExporter.frm @@ -442,8 +442,12 @@ Private Function getHeaderRangeAddress() As String ' ' Or, if header export is deselected, report accordingly + Dim headerRange As Range + + Set headerRange = getHeaderRange + If ChBxHeaderRows.Value Then - If checkHeaderRowValues Then + If Not headerRange Is Nothing And checkHeaderRowValues Then getHeaderRangeAddress = getHeaderRange.Address( _ RowAbsolute:=False, ColumnAbsolute:=False _ ) diff --git a/src/UFExporter.frx b/src/UFExporter.frx index b392f93db96c86d0f61449487b7f607a80f2b11f..1f0b7bf47e60d13237afcc5eb47aa3f9b9a11d21 100644 GIT binary patch delta 373 zcmbQCGDBrU3k$123*(nln>$&aGBYwv&gW2-$kkGEWnhwE&|qRCs{!ka;FJQ|-^`;0Hgp3| zoDfKb2-rBFcN$9aGx8@Z@PgfPhsOxy4?`A($uoE(nex&nf9BO?ESjvy*8x;Ic{QId z&_y@-G#OJTGxLWrX(>&P<~Ih~(a)dEm^=A1zaCSS(qv@;Fcl1>?3E@r11X@o%>w$2 b`I8?D=y6mju?RCT)Qe6&C}=-9Lht|p4=H4O delta 373 zcmX|*y-Px27{#CaVcqx5d#~CDL3lI0fqiI1QE-Q9u&t>eiXe)(xR{z*M2mtAHW{2n z+M^)}!GEB}mTGM(h@jo2A)?nCG#$=455MQs?YiAOQ+@fX@NKMhu6`&|964=tkh1Az zk_Ra+6Lk@lmrwG!LNP^XXi*X2S)1#K#^$6IEV6kRdKY%MA64e{4d&pOh494|G_q0} z(Y1sh7Qrbqkm26V1s_lk>A?qw+j!&?3JKyj?+|aam@S+fp|}v^e}K+cce82NA?u)< z=vBc2kKnRr(&s27FX4%Y@!3;CjSUG%#Xs&LoBr+4is<`1n3!EI=JGBgdemF}=AXu_ zI*hu$DIe{lttTYHh*9mB8zUhV@nVdLNHN!Cm#}5dNET}5p7_u{Q>~3UlRZT From 63a424f372d513fd644e1717d02447b092145658 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Fri, 7 Feb 2020 10:39:30 -0500 Subject: [PATCH 2/2] Improve reporting of error states Distinguish between "the definition of the header row(s) is bad" and "the current Selection is invalid" error states in the reporting into the status box on the form. --- src/UFExporter.frm | 18 ++++++++++++++++-- src/UFExporter.frx | Bin 4632 -> 4632 bytes 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/UFExporter.frm b/src/UFExporter.frm index 8d5b29e..fc37162 100644 --- a/src/UFExporter.frm +++ b/src/UFExporter.frm @@ -43,6 +43,7 @@ Attribute appn.VB_VarHelpID = -1 Const NoFolderStr As String = "" Const InvalidSelStr As String = "" Const NoHeaderRngStr As String = "" +Const BadHeaderDefStr As String = "" ' ===== GLOBALS ===== @@ -444,15 +445,28 @@ Private Function getHeaderRangeAddress() As String Dim headerRange As Range + ' Store the return value from retrieving the header range Set headerRange = getHeaderRange If ChBxHeaderRows.Value Then - If Not headerRange Is Nothing And checkHeaderRowValues Then + ' Header range has to be defined in order for there to be + ' an address to return. The validity of the header row + ' definition in the userform is already checked + ' within getHeaderRange, and so it doesn't need(?) to be + ' checked again here. + If Not headerRange Is Nothing Then getHeaderRangeAddress = getHeaderRange.Address( _ RowAbsolute:=False, ColumnAbsolute:=False _ ) Else - getHeaderRangeAddress = InvalidSelStr + ' Though, it's clearer to change the error message in the display box + ' depending on whether the header definition is invalid, + ' or if the actual range selection on ActiveSheet is bad + If Not checkHeaderRowValues Then + getHeaderRangeAddress = BadHeaderDefStr + Else + getHeaderRangeAddress = InvalidSelStr + End If End If Else getHeaderRangeAddress = NoHeaderRngStr diff --git a/src/UFExporter.frx b/src/UFExporter.frx index 1f0b7bf47e60d13237afcc5eb47aa3f9b9a11d21..fe2f963e716b750d6cb40c6327b77b7421bc7c34 100644 GIT binary patch delta 401 zcmXw!y-UMT6vb~|V>K^L(pn0l#@4oC7Xw!DBTE!f9Gn!2r63gZNDKL>t%6$xQFN;G zF2${rYr%g&-2}luz(GfM7bo#Wa5`|#?;g(W<$L+Tg(yDV-M-vki?W!i`pzbhF(?p# zD8Sj~X(MRjygZZqcK&<-7~=kh8?;#Ha}GzOC7hC}I?RKuz_nS^bh09vw1`(yHqB4S zBow$vAy9XjU-g&?EqLZtt2iy`#B}geDu!i~be!~cT%jfM?cfbHL-U0iv=*#48qBvX zr%NXU2Q%_=j&I8RHLL$yj}^MhpI~NRKjM4dBlsifobJiSkje2ie5E>m%HAk**>>Hw znV;DR+!N1lS!mHTUd9Tf7T_S(MOBI7M{FJ!#WePmGU)(*DRU7HV@|CI4BKis;xUGA z>Z|}5(Mp6z6>UM#v7;RdJNTs;!~)F44Z>X9;}Upy&V^Uq#}7s<5R(Ay6h0;_+)q6G E0_D?eAOHXW delta 420 zcmYL^&q@MO6vofYoyt4@#{v;Wy9$YvkWtiZEW~JCAc+u24kkD=rU~N4AX~Ia>1?DI z2%^P+FHp-O=m84ay0-`DUKh3canJYN?|f&J7$xj$Md?dFZ{r)qsRWG_%Yz(*qzo_* zaGCEktmcJH@X5gzZ8DPpV2(?khgV{?`|{zHikldQ&4z0eFz`mWE}G zV25U+!WV`l&!NIstLtXj&^7*k<-t3+Od}$4LNnq=SPjWthTCdE42P;FhVN>c+GMZM z(9KE~2Q-Szxf$oVv01L?uew`3ESptb>#}oR>YMN$F}!!K@m^6H^UJJUv4KyL|O{8>EqKmP)< Cs%*pn