How to disable Workbook_Open Msgboxes & userforms after SaveAs

SWHarmon79

New Member
Joined
Aug 18, 2018
Messages
13
Office Version
  1. 365
Platform
  1. Windows
I have a workbook for internal estimating that several people in my company use. I am adding VBA to make the workbook more user friendly and efficient.

1. User opens workbook and is prompted by a Y/N Textbox. "Would you like to start an estimate"
a. User presses "No", then estimate opens without any changes.
b. User presses "Yes", Then Userform "Estimate_Setup" opens.
2. User fills out the form and presses the "Start Estimate" button on the userform.
3. The info in the userform is then saved in the workbook in various sheets depending on the info.
4. The userform Calls the "Save_As" sub
5. User finishes and closes the workbook.
6. Later the user reopens the saved estimate workbook and the process starts over. I would like for the entire process of steps 1 - 4 to not be performed on any workbooks after the "Save_As" sub runs. So that later when a user reopens a saved estimate to work on they aren't prompted to start an estimate that they are already in the middles of and have filled out the "Estimate_Setup" userform.

I have added the relevant code that is responsible for the above.

I appreciate any and all help!!! Thanks in advance.


1
Code:
Private Sub Workbook_Open()




'Allow Outline functionality during Protection in all Sheets
Dim sht As Worksheet


'Loop through each Worksheet in ActiveWorkbook
  For Each sht In ActiveWorkbook.Worksheets
  'Password Protect Current Sheet
      sht.Protect Password:="W3lcome2019", UserInterfaceOnly:=True, AllowSorting:=True, AllowFiltering:=True
  'Enable Group Collapse/Expand Capabilities
      sht.EnableOutlining = True


Next sht


Call Start_Estimate_Msgbox




End Sub

2
Code:
Sub Start_Estimate_Msgbox()


Dim Result As Long


    Result = MsgBox("Would you like to start an estimate?", vbYesNo + vbQuestion, "Estimate Set-Up")


    If Result = vbYes Then
        f_Estimate_Setup.Show
    End If
    
    If Result = vbNo Then
        Sheet1.Columns("A:BM").Hidden = False
        
        Call Unhide_Multiple_Sheets


    End If
    


End Sub

3
Code:
Sub Estimate_Save_As()


Dim Path As String
Dim filename As String


Path = "C:\Users\shawn.harmon\Desktop\Material list test\Test Copies\"
filename = f_Estimate_Setup.txt_PrNm.Text & " " & f_Estimate_Setup.cbx_CustNm.Text & " " & Format(Now, "mmddyy")


ActiveWorkbook.SaveAs filename:=Path & filename & ".xlsm"


End Sub
 
You're welcome & thanks for the feedback
 
Upvote 0

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,224,825
Messages
6,181,190
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top