Cannot change my VBA in my Excel file?!?!?!


Posted by Stacy on May 25, 2001 6:27 AM

Hello everyone! I created some charts in Excel along with some other misc data. I created a form that appears 'on open'. The form has two buttons. Button One Prints....Button Two is supposed to close the current workbook. There is also some code to prevent the user from clicking the 'X' in the upper right corner of the form. Here is all the code that I have. I realized that my 'Unload UserForm1' command is reversed. I don't think that would cause too big of a problem though...and when I go and try and change any code, the file locks and shuts down. Anyway...I can't seem to figure this one out. I would appreciate any help someone could offer. Thanks!!!! Stacy

-----------
Private Sub CommandButton1_Click()
Module1.Print_Sheets
End Sub
-----------
Private Sub CommandButton2_Click()

UserForm1 Unload

End Sub
-----------
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)

If CloseMode = 0 Then 'They hit the X

MsgBox "Sorry, you must choose a button", _
vbInformation, ""
Cancel = True 'Stop from closing

End If

End Sub
------------

Posted by Stacy on May 25, 2001 6:34 AM

one more thing....

One more thing....the way it seems is that anything I do that causes the program to reset, causes the file to shut down and lock on me.

Thanks again.



Posted by Dave Hawley on May 25, 2001 5:38 PM

Re: one more thing....


Hi Stacy

Sounds like a corrupt Workbook and/or Module. Copy the content of each Module to a New Workbooks Module. Don't copy the Module Object itself though.


Dave

OzGrid Business Applications