How to create a word document from excel

hfalstom

New Member
Joined
Sep 19, 2014
Messages
2
Hi, everybody! (and thanks in advance...)

I have a spreadsheet and I want to, by running a macro, create a new word file named after the active cell and based on a specific template.

I am trying the code bellow, withouth success.

Can someone please help me?

I also have a question, after creating the file, it opens automatically or do I have "ask" the macro to open it?

Thank you very much!

Sub Criar()


File.NewFile filename = "c\:" &ActiveCel &".docx" /t: "c:\papel carta.dot" /editor:"C:\Program Files (x86)\Microsoft Office\Office14\winword.exe"


File.Openfile Filename = "c\:" & ActiveCel & ".docx"


End Sub
 

Some videos you may like

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Watch MrExcel Video

Forum statistics

Threads
1,109,523
Messages
5,529,333
Members
409,863
Latest member
stacy09
Top