Good day everyone, need to pick your brains on a strange Access vbscript issue I am having. I have two dBases, one original and one modification of the original.
I used all the same vbscripts macros from the original because they worked exactly how I need them. The modifications only include the additions of some queries and tabs.
Now, for some reason I am getting a Run-time error 424, Object Required in the mod version and I am not sure why, because it still works in the original. Debugger highlights the line I made bold/red.. Any thoughts on why this is happening in one dBase version, but not the other?
I used all the same vbscripts macros from the original because they worked exactly how I need them. The modifications only include the additions of some queries and tabs.
Now, for some reason I am getting a Run-time error 424, Object Required in the mod version and I am not sure why, because it still works in the original. Debugger highlights the line I made bold/red.. Any thoughts on why this is happening in one dBase version, but not the other?
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")
[B][COLOR=#ff0000] arrCurrentFormInfo = Split(txtCurrentForm.Value, ":")[/COLOR][/B]
If UBound(arrCurrentFormInfo) = 1 Then
strCurrentForm = Replace(arrCurrentFormInfo(0), "form.", "")
strOutputFileName = arrCurrentFormInfo(1)
Else
strCurrentForm = Replace(txtCurrentForm.Value, "form.", "")
strOutputFileName = strCurrentForm
End If
'MsgBox txtCurrentForm
strRecordSource = Me!NavigationSubform.Form.RecordSource
'MsgBox strRecordSource
strOutputFile = Application.CurrentProject.Path & "\" & strOutputFileName & ".xlsx"
'DoCmd.OutputTo acOutputForm, frmCurrentForm, acFormatXLSX, Application.CurrentProject.Path & "\" & txtOutputFileName & ".xlsx", -1
If Left(strRecordSource, 3) = "tbl" Then
DoCmd.OutputTo acOutputTable, strRecordSource, acFormatXLSX, strOutputFile
Else
DoCmd.OutputTo acOutputQuery, strRecordSource, acFormatXLSX, strOutputFile
End If
'MsgBox strOutputFile
Call FormatExcelSS(strOutputFile, "B1")
objShell.Run "Excel.exe" & " " & Chr(34) & strOutputFile & Chr(34), , True
End Sub