Skip to content

Commit

Permalink
Improve reporting of error states
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bskinn committed Feb 7, 2020
1 parent b8aa429 commit 63a424f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/UFExporter.frm
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Attribute appn.VB_VarHelpID = -1
Const NoFolderStr As String = "<none>"
Const InvalidSelStr As String = "<invalid selection>"
Const NoHeaderRngStr As String = "<no header>"
Const BadHeaderDefStr As String = "<invalid definition>"


' ===== GLOBALS =====
Expand Down Expand Up @@ -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
Expand Down
Binary file modified src/UFExporter.frx
Binary file not shown.

0 comments on commit 63a424f

Please sign in to comment.