When you create a document using the Create Document command, the system variable Document contains the pathname of the document created (assuming that the document was created successfully).
Before checking the system variable Document, you should check the system variable OK to see if the document was successfully created. The OK variable is set to 1 when document is correctly created and opened. The code below shows how to retrieve the pathname of the document created:
vhDoc:=Create document("") ` Create new document using the save dialog.
mDocPathname:=Document ` Get pathname of document
CLOSE DOCUMENT(vhDoc) ` Close the document