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
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,213,489
Messages
6,113,954
Members
448,535
Latest member
alrossman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top