Excel 2007 file format file extension not valid error

G

Guest

Converting complicated application to Excel 2007.

Testing chart macros and protection schemes in a simple new macro enabled
template (*.xltm). I created a new template, wrote some macros, and
protected the workbook and worksheet using the below VBA code.

Sub mProtect(ws As Worksheet)
Dim v As Integer, p As String
v = Application.version
p = "foo" 'the password

Select Case v

Case Is >= 12
ws.Protect Password:=p, userinterfaceonly:=True,
DrawingObjects:=True, AllowFormattingCells:=False, contents:=True

etc.

The workbook was working brilliantly. I saved the workbook in its protected
state and closed Excel using the File/ Save As /Excel Macro Enabled Template
(*.xltm) format.

When I tried to open the file, I got the following Excel error: "Excel
cannot open the file 'protectFun.xltm' because the file format or file
extension is not valid. Verify that the file has not been corrupted and that
the file extension matches the format of the file"

This also happened with another similar file previously.

Any ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top