Application Interface Freezes (1 Viewer)

Tanner65

Registered User.
Local time
Today, 13:23
Joined
Aug 31, 2007
Messages
66
Hey guys, I've run into a problem I can't seem to find a solution for.

I've got a packing list that I don't want the user to save over or print without saving to another location; both of which I've interrupted using the BeforeSave and the BeforePrint. Both of these feed into the same module, but I'm only running into a problem with the BeforePrint one.

After running through the whole process of printing Excel will do one of two things: 1) Either a "Single Step" window will pop up and wont let me close it unless I kill the whole application; or 2) It'll print, but when I try to do anything to the grid nothing will happen, can't select anything or enter any cells until I run a toolbar macro.


Here is the code in the workbook that interrupts the save and print:
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Excel.Application.DisplayAlerts = False
    ActiveWorkbook.Close False
End Sub

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim strMsgBox As String

    strMsgBox = MsgBox("Printing the template is not allowed;" & vbCrLf & "Would you like to save this file and print?", vbYesNo, strMsgTitle)
    
    If strMsgBox = vbNo Then Cancel = True
    If strMsgBox = vbYes Then Cancel = False: If modSaving.NewWorkbook(True) = True Then MsgBox "Save complete, now able to print", vbOKOnly, strMsgTitle
    Excel.Application.ScreenUpdating = True
End Sub

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    If modSaving.NewWorkbook = True Then MsgBox "Save complete", vbOKOnly, strMsgTitle
    Cancel = True
End Sub

Attached is the save module; please be gentle with suggestions, this is still in a developmental stage so there's a lot of different ways I'm trying to do things being that I'm not an expert.

Thanks for any and all help!
 

Attachments

  • modSaving.txt
    7.4 KB · Views: 241

Tanner65

Registered User.
Local time
Today, 13:23
Joined
Aug 31, 2007
Messages
66
No one has any ideas?

Oh well, I've scrapped that project anyway.

If someone does find a solution, let me know though! :)
 

Users who are viewing this thread

Top Bottom