Hello - I'm having issues with a user prompt message box not appearing when I call it from a userform that I created. Half the time it appears, and half the time it doesn't appear.
The user prompt is shown below in the second macro... "EditAlert". If i run the macro by itself (not calling it from another procedure), it works fine.
Initially I thought the problem could have resulted from me using the "Application.DisplayAlerts" messsages, but I don't think it's the issue. I'm using this code so that the "would you like to overwrite the existing file" message doesn't appear. I suppose I could get rid of the DisplayAlerts messages if there's an option in the workbook.SaveAs method for it, but I couldn't find it....
But back to my problem with calling the EditsPrompt from another macro.. Can anyone point out what I could be doing wrong (or inefficiently). Again, the user prompt message does show up half the time, but it's not consistent.
'*********Userform "Save Form" ***********
Sub CommandButton2_Click()
Me.Hide
Range("savepath").Formula = SaveForm.Savelistbox.Text
Set SaveWB = Workbooks.Add
ThisWorkbook.Sheets("DB").Range("exceldb").Copy
SaveWB.Sheets("Sheet1").Range("A1").PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=savepath
ActiveWindow.Close
Application.DisplayAlerts = True
If Me.OracleCheckbox = True Then
editprompt
End If
End Sub
'******** Edit Prompt ***********
Sub editprompt()
Application.DisplayAlerts = True
Dim EditAlert, Style, Title, Help, Ctxt, Answer
If IsError(Range("EditsCount").Value) Then
MsgBox "Inputs may be required. See oracle edits, lines 1503 to 1508"
gotoOracleEdits
Exit Sub
End If
If Range("EditsCount").Value > 0 Then
EditAlert = "There are Edits. Would you like to review the Edit Report before saving to Oracle?"
Style = vbYesNo + vbExclamation + vbDefaultButton1
Title = "Edit Alert"
Answer = MsgBox(EditAlert, Style, Title, Help, Ctxt)
If Answer = vbYes Then
gotoCSEDITS
Exit Sub
End If
If Answer = vbNo Then
oraclesave
'UpdateOracleSaveQuery
End If
End If
If Range("EditsCount").Value = 0 Then
oraclesave
End If
End Sub
The user prompt is shown below in the second macro... "EditAlert". If i run the macro by itself (not calling it from another procedure), it works fine.
Initially I thought the problem could have resulted from me using the "Application.DisplayAlerts" messsages, but I don't think it's the issue. I'm using this code so that the "would you like to overwrite the existing file" message doesn't appear. I suppose I could get rid of the DisplayAlerts messages if there's an option in the workbook.SaveAs method for it, but I couldn't find it....
But back to my problem with calling the EditsPrompt from another macro.. Can anyone point out what I could be doing wrong (or inefficiently). Again, the user prompt message does show up half the time, but it's not consistent.
'*********Userform "Save Form" ***********
Sub CommandButton2_Click()
Me.Hide
Range("savepath").Formula = SaveForm.Savelistbox.Text
Set SaveWB = Workbooks.Add
ThisWorkbook.Sheets("DB").Range("exceldb").Copy
SaveWB.Sheets("Sheet1").Range("A1").PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=savepath
ActiveWindow.Close
Application.DisplayAlerts = True
If Me.OracleCheckbox = True Then
editprompt
End If
End Sub
'******** Edit Prompt ***********
Sub editprompt()
Application.DisplayAlerts = True
Dim EditAlert, Style, Title, Help, Ctxt, Answer
If IsError(Range("EditsCount").Value) Then
MsgBox "Inputs may be required. See oracle edits, lines 1503 to 1508"
gotoOracleEdits
Exit Sub
End If
If Range("EditsCount").Value > 0 Then
EditAlert = "There are Edits. Would you like to review the Edit Report before saving to Oracle?"
Style = vbYesNo + vbExclamation + vbDefaultButton1
Title = "Edit Alert"
Answer = MsgBox(EditAlert, Style, Title, Help, Ctxt)
If Answer = vbYes Then
gotoCSEDITS
Exit Sub
End If
If Answer = vbNo Then
oraclesave
'UpdateOracleSaveQuery
End If
End If
If Range("EditsCount").Value = 0 Then
oraclesave
End If
End Sub