I have the following code for exporting data from the dBase to excel.. It works and works great. I am wondering though if there is a way to add a line into the code that when exported, IF A2 is NULL insert "NO ACTIVITY FOR REVIEW FOUND"
VBA Code:
Private Sub cmdExport_Click()
Dim arrCurrentFormInfo
Dim strCurrentForm
Dim strCaption
Dim strOutputFileName
Dim strRecordSource
Dim strOutputFile
Dim objShell
Set objShell = VBA.CreateObject("wscript.shell")
arrCurrentFormInfo = Split(txtCurrentForm.Value, ":")
If UBound(arrCurrentFormInfo) = 1 Then
strCurrentForm = Replace(arrCurrentFormInfo(0), "form.", "")
strOutputFileName = arrCurrentFormInfo(1)
Else
strCurrentForm = Replace(txtCurrentForm.Value, "form.", "")
strOutputFileName = strCurrentForm
End If
strRecordSource = Me!NavigationSubform.Form.RecordSource
strOutputFile = Application.CurrentProject.Path & "\Exported Data\" & strOutputFileName & ".xlsx"
If Left(strRecordSource, 3) = "tbl" Then
DoCmd.OutputTo acOutputTable, strRecordSource, acFormatXLSX, strOutputFile
Else
DoCmd.OutputTo acOutputQuery, strRecordSource, acFormatXLSX, strOutputFile
End If
Call FormatExcelSS(strOutputFile, "B1")
objShell.Run "Excel.exe" & " " & Chr(34) & strOutputFile & Chr(34), , True
End Sub