[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 302
  • Last Modified:

VBA: Workbook close but prompt to user to verify data upload

Experts,

I have a workbook that users fill out and then press the upload data button to export their info.

I am running into an issue where some folks are just filling out the form and not hitting the upload button.  Is there a way to prompt a user to upload their info when they hit the X to close out the workbook?

If so any ideas?

0
Maliki Hassani
Asked:
Maliki Hassani
  • 4
  • 2
1 Solution
 
NorieVBA ExpertCommented:
You could add code in the workbook's close event to either do the upload or prompt the user to do it.

For that you'd need some way to check if the upload has been done or not.
0
 
Maliki HassaniAuthor Commented:
Well my upload verifies if the tickID is a duplicate already..  I just need to know a way to have the popup message show everytime the X is pressed.

I found something on the net that stops the X from being pressed and a code for yes or no to close.

However, the 2nd code isn't working.

'Private Sub Workbook_BeforeClose(Cancel As Boolean)
'Cancel = True
'End Sub

'------Second code
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If MsgBox("Are you sure", vbQuestion + vbYesNo, "Close the book") =
vbNo Then
Cancel = True
End If
End Sub
0
 
Maliki HassaniAuthor Commented:
Okay, I got the second code to work.    Now I am working the code to run my macro.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
NorieVBA ExpertCommented:
Do you mean the macro/code for the upload?

You should just be able to call that from the BeforeClose event.
0
 
Maliki HassaniAuthor Commented:
Yes, that is what I will do
0
 
Maliki HassaniAuthor Commented:
Private Sub Workbook_BeforeClose(Cancel As Boolean)

Dim Answer2 As String

Answer2 = MsgBox("Check: Did you upload your data?", vbQuestion + vbYesNo, "Close the book")

    If Answer2 = vbNo Then
           
        Call DataExport
       
        Else
   
    End If

End Sub
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now