title: VBA SaveAs method not saving file, no errors?
body: <p>Before anyone quickflags this: no, I did not forget to actually save the file after GetSaveAsFilename.</p>
  
  <p>Basically, I've got a big VBA module that starts with an Excel file, processes a bunch of data, and generates a summary in Excel. I want it to be impossible to overwrite the file, and I need it to work in all cases (network drives, opening from email, etc). This is why I thought it would be best just to open a SaveAs box--leave the onus of the path on the user. However, when I trigger this method by saving with macros enabled, everything behaves as expected except the file itself does not save. The debugger says that fileName is what it should be at the time the SaveAs method is called, so I'm truly stumped here. There's no error thrown.</p>
  
  <p>Thanks to anyone who can help! My code is below:</p>
  
  <pre><code>Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
  
  Dim fileName As String, oldName As String, fullName As String
  Dim fragName() As String, noExtension As String, filePath As String
  Dim newName As String
  
  Cancel = True
  oldName = ThisWorkbook.Name
  fullName = ThisWorkbook.fullName
  fragName() = Split(fullName, ".", 2)
  noExtension = fragName(0)
  filePath = ThisWorkbook.Path &amp; "\"
  Application.enableEvents = False
  
  enterName:
  fileName = Application.GetSaveAsFilename(InitialFileName:=filePath, _
      FileFilter:="Microsoft Excel Worksheet (*.xlsx), *.xlsx")
  On Error GoTo getOut
  
  If fullName = fileName Then
  MsgBox ("You have chosen the same name, " &amp; oldName &amp; vbCr _
  &amp; ", please choose something different.")
  GoTo enterName
  
  ElseIf fileName = "False" Then GoTo getOut
  
  End If
  
  ThisWorkbook.SaveAs (fileName)
  
  getOut:
  Application.enableEvents = True
  End Sub
  </code></pre>