Save Dialog pops up now - Excel 2007

M

mcescher

I have a macro that creates my file and then saves it. I've just
recently upgraded to Office 2007, and now Excel prompts me to save the
file when it didn't before.

I'm doing a SaveAs, and specifying the path\filename. Can I turn off
the "Do you want to save" message and just do it? Code follows:


Public Sub SaveExcelReport(strFullName As String)
Dim objFS As Object
Dim strFolder As String
On Error GoTo SaveExcelReport_Error:
''Create reports directory if it doesn't exist
Set objFS = CreateObject("Scripting.FileSystemObject")
strFolder = Left$(strFullName, InStrRev(strFullName, "\", -1,
vbTextCompare))
If Not objFS.folderexists(strFolder) Then
objFS.createfolder (strFolder)
End If
''Overwrite without warning
xlaReport.DisplayAlerts = False
xlaReport.ActiveWorkbook.SaveAs strFullName, xlExcel12, "", "",
False, False, xlNoChange, xlLocalSessionChanges
''Old (Access 2003) version
'xlaReport.ActiveWorkbook.SaveAs strFullName, xlNormal, "", "",
False, False
xlaReport.DisplayAlerts = True
Exit Sub
SaveExcelReport_Error:
Debug.Print Err.Description
Resume Next
End Sub

Thanks for taking the time to look,
Chris M.
 
M

mcescher

I have a macro that creates my file and then saves it.  I've just
recently upgraded to Office 2007, and now Excel prompts me to save the
file when it didn't before.

I'm doing a SaveAs, and specifying the path\filename.  Can I turn off
the "Do you want to save" message and just do it?  Code follows:

Public Sub SaveExcelReport(strFullName As String)
  Dim objFS As Object
  Dim strFolder As String
  On Error GoTo SaveExcelReport_Error:
''Create reports directory if it doesn't exist
  Set objFS = CreateObject("Scripting.FileSystemObject")
  strFolder = Left$(strFullName, InStrRev(strFullName, "\", -1,
vbTextCompare))
  If Not objFS.folderexists(strFolder) Then
    objFS.createfolder (strFolder)
  End If
''Overwrite without warning
  xlaReport.DisplayAlerts = False
  xlaReport.ActiveWorkbook.SaveAs strFullName, xlExcel12, "", "",
False, False, xlNoChange, xlLocalSessionChanges
''Old (Access 2003) version
  'xlaReport.ActiveWorkbook.SaveAs strFullName, xlNormal, "", "",
False, False
  xlaReport.DisplayAlerts = True
  Exit Sub
SaveExcelReport_Error:
  Debug.Print Err.Description
  Resume Next
End Sub

Thanks for taking the time to look,
Chris M.

I did try changing the file type to xlWorkbookNormal, and then it
saves fine, but when I double click on the resulting file, I get an
error message "Excel cannot open the file XXXXXX.xlsx 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"

sigh....

Thanks!
Chris M.
 

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