PDA

View Full Version : Macro does not work after converting to .exe


kvinay_00
Jul 17, 2009, 03:48 AM
I am using below macro in a sheet and wants to convert the sheet to .exe format by using a XLTOEXE program.

Macro works perfectly in normal .xls sheet. However, it does not work correctly in the converted file (converted to .exe). It gives the message as per the macro message box but still opens the Save As box.

Can somebody help?

I have put it in THISWORKBOOK.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

If SaveAsUI = True Then

MsgBox "Use Save option"
Cancel = True

End If

End Sub

Thanks

Vinay

JBeaucaire
Jul 17, 2009, 10:58 AM
Of course other may respond, but if you're having a specific problem using a specific program, perhaps giving us the exact full name and publisher of the program you're having difficulty with at least gives us a chance to help you research an answer.

Meanwhile, I would suggest you start at that publisher's own support site or Google search by the program first, then your issue. Like this:

Google Search: "XLSTOEXE Save doesn't work"
... or something similar.

Q: You ARE using SAVE and not SAVEAS, right?

kvinay_00
Jul 17, 2009, 08:31 PM
I am attaching original .xls file which I am using. I am unable to attach the converted .exe file.

Below is the link of the program I have used to convert .xls to .exe -

Converter from XL to EXE - Convert Microsoft Excel Files to Executable Files (http://orlando.mvps.org/XLtoEXEMore.asp)

Thanks

Vinay

JBeaucaire
Jul 17, 2009, 11:32 PM
Open up your ThisWorkbook module, clear it out and put this in there instead:


Private Sub Workbook_Open()
Application.CommandBars("File").Controls(5).Enabled = False
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("File").Controls(5).Enabled = True
End Sub

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If SaveAsUI = True Then
MsgBox "SaveAs not allowed. Changes saved...workbook closing."
ThisWorkbook.Close True
End If
End Sub

This will not only disable the SaveAs button on the FILE menu, if someone is savvy enough to know about F12, pressing it will cause their sheet to be saved and the workbook closed before the SaveAs window has a chance to open.

Best I can think of. This does work with your XLtoEXE program.

kvinay_00
Jul 18, 2009, 03:58 AM
Great!

Thanks JB