Skip to content

Commit

Permalink
Merge pull request #27 from bskinn/fix-header-error
Browse files Browse the repository at this point in the history
Fix header error
  • Loading branch information
bskinn authored Feb 7, 2020
2 parents f9a6328 + 63a424f commit 569dcaf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
22 changes: 20 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 @@ -442,13 +443,30 @@ Private Function getHeaderRangeAddress() As String
'
' Or, if header export is deselected, report accordingly

Dim headerRange As Range

' Store the return value from retrieving the header range
Set headerRange = getHeaderRange

If ChBxHeaderRows.Value Then
If 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 569dcaf

Please sign in to comment.