Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Spreadsheets (https://www.askmehelpdesk.com/forumdisplay.php?f=395)
-   -   Macro does not work after converting to .exe (https://www.askmehelpdesk.com/showthread.php?t=376625)

  • Jul 17, 2009, 03:48 AM
    kvinay_00
    Macro does not work after converting to .exe
    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
  • Jul 17, 2009, 10:58 AM
    JBeaucaire

    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?
  • Jul 17, 2009, 08:31 PM
    kvinay_00
    1 Attachment(s)
    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

    Thanks

    Vinay
  • Jul 17, 2009, 11:32 PM
    JBeaucaire

    Open up your ThisWorkbook module, clear it out and put this in there instead:

    Code:

    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.
  • Jul 18, 2009, 03:58 AM
    kvinay_00
    Great!

    Thanks JB

  • All times are GMT -7. The time now is 05:35 AM.