Re: create a new word document based on a specific model (template)
Quote from gn00588950;726987Display MoreHi Herique,
May I know is anything returned in "Result Column"? It should either return "File Already Exist." or "File Created."
If you can see this in Result column, you may need to debug it In Step-By-Step Mode (Run with F8)
First of all, change the following and run with F8.
This will let you able to see if the code has opened MS Word or not.
If it dose open MS Word, then check this line to see if it saved the document
If the above line cannot save any files, try the following:
CodeObjWord.ActiveDocument.SaveAs FileName:=Cell.Value, FileFormat:=12 'FileFormat:=12 means save as docx. If you want .doc, you can change to FileFormat:=8 (Don't forget to change your File Name as well. I.e.: C:\Test.doc)
Hope this help.
Tony,
No results are shown in the result column.
I ran the code with F8. It goes line by line to "If IsFileOpen("C:\papel carta.dotx") Then Exit Sub 'Change Your Template Path If Needed", then it jumps to "Function IsFileOpen(FileName As String)", goes line by line and comes back to "If IsFileOpen...." and then it exits.
Word is closed, the path is OK, but nothing happens.
Do I have to open the template first?