Exporting Worksheet to XLSX file Not Working

Hello- XLSPadlock looks great and we’re evaluating for use in our company.

One of the tasks our workbooks do is export a worksheet as it’s own xlsx workbook via VBA. When I compile the workbook into an exe file, the worksheet is not being saved as it’s own workbook. The saving VBA is"

ThisWorkbook.Application.DisplayAlerts = False
On Error Resume Next
Err.Clear
.Parent.SaveAs ThisWorkbook.Path & “” & “PPTDATA.xlsx” ‘’

    If Err.Number = 0 Then
        .Parent.Close SaveChanges:=False
        MsgBox "Success! The data has been exported successfully!"
        ThisWorkbook.Activate
    Else
        MsgBox "Error while saving! Please check your drive and save it manually then."
    End If

I’m getting the message saving is successful, but when its compiled into the exe format, the file isn’t being saved.

Any thoughts?

Thanks!

The error lies here:

XLS Padlock stores the compiled workbook at a random virtual location, so ThisWorkbook.Path isn’t pointing to the folder that contains the EXE file.
You can use our workaround explained in the user guide or here:
image

Your code will work if you add the pathtofile sub to your VBA project (or in a new module) and then use:

ThisWorkbook.Application.DisplayAlerts = False
On Error Resume Next
Err.Clear
.Parent.SaveAs PathToFile("PPTDATA.xlsx")
........etc

Got it! Thank you for the thorough answer. I’m assuming that since its an exe and virtualized, OLE links to this workbook will no longer work?

Thanks! Very helpful.

No, they should still work.

Interesting. I’ll have to give it a whirl.

Thx!