title: Run time error 1004 for saving excel file (VBA required)
body: <p>I was wondering if anyone knows how to use <a href="/questions/tagged/vba" class="post-tag" title="show questions tagged 'vba'" rel="tag">vba</a> to save a <code>.txt</code> file that is opened in excel?</p>
  
  <p>I have tried writing a coding with a UserForm, but it is giving me errors.</p>
  
  <p>I was wondering if it is possible to give user the option to save it at his/her favourite spot, and also his/her favorite name?</p>
  
  <pre><code> Public Sub CommandButton1_Click()
   Dim YesOrNoAnswerToMessageBox As String
   Dim QuestionToMessageBox As String
   Dim CurrentFile As String
  
   QuestionToMessageBox = "Do you want to save?"
  
  YesOrNoAnswerToMessageBox = MsgBox(QuestionToMessageBox, vbYesNo, "Save file")
  
  If YesOrNoAnswerToMessageBox = vbNo Then
       Unload Me 'Cancellation command
  Else
  CurrentFile = ThisWorkbook.FullName
  ActiveWorkbook.SaveAs "C:\myfile.xls", FileFormat:=52
  Workbooks.Open CurrentFile
  End If
  End Sub
  </code></pre>