<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> Make_Word_Doc()<br><br> <SPAN style="color:#007F00">' Add a reference to the MS-Word library:</SPAN><br> <SPAN style="color:#007F00">' from the VBA menu, select Tools\References</SPAN><br> <SPAN style="color:#007F00">' select 'Microsoft Word x.0 Object Library'</SPAN><br> <br> <SPAN style="color:#00007F">Dim</SPAN> WrdApp <SPAN style="color:#00007F">As</SPAN> Word.Application<br> <SPAN style="color:#00007F">Dim</SPAN> WrdDoc <SPAN style="color:#00007F">As</SPAN> Word.Document<br> <SPAN style="color:#00007F">Dim</SPAN> strWrdDate <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN><br> <SPAN style="color:#00007F">Dim</SPAN> strWrdFilename <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN><br> <br>Retry:<br> strWrdDate = Application.InputBox(Prompt:="Enter a date as dd.mm.yyyyy ", _<br> Title:="Date as Word.doc Filename", _<br> Default:=Format(Date, "dd.mm.yyyy"), Type:=2)<br> <SPAN style="color:#00007F">If</SPAN> strWrdDate = "False" <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Sub</SPAN> <SPAN style="color:#007F00">'User canceled</SPAN><br> <br> <SPAN style="color:#00007F">If</SPAN> <SPAN style="color:#00007F">Not</SPAN> strWrdDate <SPAN style="color:#00007F">Like</SPAN> "##.##.####" <SPAN style="color:#00007F">Then</SPAN><br> MsgBox "Please enter a date using the dd.mm.yyyy format. ", vbExclamation, "Invalid Date Format"<br> <SPAN style="color:#00007F">GoTo</SPAN> Retry<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br> strWrdFilename = ThisWorkbook.Path & Application.PathSeparator & strWrdDate & ".docx"<br> <br> <SPAN style="color:#00007F">Set</SPAN> WrdApp = CreateObject("Word.Application")<br> <SPAN style="color:#007F00">'wrdApp.Visible = True</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> WrdDoc = WrdApp.Documents.Add <SPAN style="color:#007F00">' create a new document</SPAN><br> <SPAN style="color:#00007F">With</SPAN> WrdDoc<br> .SaveAs strWrdFilename <SPAN style="color:#007F00">' save the document</SPAN><br> .Close <SPAN style="color:#007F00">' close the document</SPAN><br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br> WrdApp.Quit <SPAN style="color:#007F00">' close the Word application</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> WrdDoc = <SPAN style="color:#00007F">Nothing</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> WrdApp = <SPAN style="color:#00007F">Nothing</SPAN><br> <br> MsgBox "Word file: " & strWrdFilename, vbInformation, "Word Document Created"<br><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>