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

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,629
Messages
5,838,453
Members
430,549
Latest member
jayjay2022

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
Top