M
Malc
I have a model that uses VBA to save the file. The variables are
dimmed as appropriate and then I use this code to compile the save
filename:
DSNDirectory = "\\" & Range("appserver") & "\" & Range("appprogdir") &
"\utils\"
DSNFilename = Range("dsnfile")
Then I use
Application.DisplayAlerts = False
ChDir DSNDirectory
ActiveWorkbook.SaveAs FileName:=DSNDirectory + DSNFilename, _
FileFormat:=xlTextMSDOS, CreateBackup:=False
DisplayAlerts = True
and this saves the particular worksheet as a text file.
And this all works until I lock the project for viewing and protect it
with a password. Once that's done running the macro that contains the
code described above results in an error 1004 method 'SaveAs' of
object '_workbook' failed. I can't debug it because it's locked, and
if I unlock it the code works. So I can't work out what's wrong!
Does anyone have any ideas?
Thanks in advance
dimmed as appropriate and then I use this code to compile the save
filename:
DSNDirectory = "\\" & Range("appserver") & "\" & Range("appprogdir") &
"\utils\"
DSNFilename = Range("dsnfile")
Then I use
Application.DisplayAlerts = False
ChDir DSNDirectory
ActiveWorkbook.SaveAs FileName:=DSNDirectory + DSNFilename, _
FileFormat:=xlTextMSDOS, CreateBackup:=False
DisplayAlerts = True
and this saves the particular worksheet as a text file.
And this all works until I lock the project for viewing and protect it
with a password. Once that's done running the macro that contains the
code described above results in an error 1004 method 'SaveAs' of
object '_workbook' failed. I can't debug it because it's locked, and
if I unlock it the code works. So I can't work out what's wrong!
Does anyone have any ideas?
Thanks in advance