PDA

View Full Version : It's possible to add a Word document with a customized name?



Vundra
02-15-2017, 10:18 AM
For drawing a parallel when I need to add an excel sheet (at the end of all) named "My name" I use:


Sheets.Add(After:=Sheets(Sheets.Count)).Name = "My name"

For adding a Word document with Excel the basic VBA code is:


Set obj*Word = CreateObject(“Word.Application”)
Set obj*Doc = objWord.Documents.Add
objWord.Visible = True

but unfortunately seems that I cannot choose a customized name for this document.

How I can do ?

PS: just for clarify better, the Word document that I want to add is only a temporary file that doesn't exist in HD