run-time error '1004' application-defined or object-defined
<p>I'm working on a file for HR, to keep track of the start- and end times of employees. I get their name and required hours, and want to open a save as dialog to save the file using the name of the employee so the HR department only has to open the template and fill in the data and save, all in one fluid motion. I made a sub for all of this and it works nice, but after the save location has been defined, I get a run-time '1004' application-defined or object-defined error.</p>

<pre><code>If ThisWorkbook.BuiltinDocumentProperties("title") = "" Then
strTitle = "Timesheet " &amp; UCase(strNaam) &amp; " " &amp; StrConv(strVoornaam, 3)
varDirectory = Application.GetSaveAsFilename(strTitle, "Timesheet Files(*.xlsm), *.xlsm")
Sheets("Data").Range("B25") = varDirectory

ActiveSheet.SaveAs Filename:=varDirectory, FileFormat:=25 ------------&gt; error
ThisWorkbook.BuiltinDocumentProperties("title") = strTitle

End If
</code></pre>

<p>Basically it changes the title of the file to something, and prompts a dialog to choose the location which it then writes in a cell (not ideal, but it's  nice workaround).</p>

<p>I get the error on the second to last line.</p>