ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Open new Word file via Excel (https://www.excelbanter.com/excel-programming/396639-open-new-word-file-via-excel.html)

Lupe

Open new Word file via Excel
 
Hi
I've created a Word template with many mergefields and includetexts. The
data source is in Excel. I want the users to be able to open automatically
via a macrobutton a new Word file based on my template when they finish enter
their source data and merge the information.
I have already managed to open an existing file via a macrobutton. I got the
following code from a post of Sept 2006 by moon. How can I elaborate on this
code to get a new file to open based on another template than normal.dot?

"Dim WRDAPP, WRDDOC
Set WRDAPP = CreateObject("Word.Application")
Set WRDDOC = WRDAPP.Documents.Open("C:\Security\Procesverbaal.d oc")
'Or for a new doc:
'Set WRDDOC = WRDAPP.Documents.Add

WRDAPP.Visible = True
'WRDAPP.Quit"
Regards, Lupe


Halim

Open new Word file via Excel
 
use this one maybe help
Dim WRDAPP, WRDDOC
Set WRDAPP = CreateObject("Word.Application")
'Or for a new doc:
Set WRDDOC = WRDAPP.Documents.Add _
Template:= "C:\Template\yourtmplate.doc"

WRDAPP.Visible = True
--
Regards,

Halim



"Lupe" wrote:

Hi
I've created a Word template with many mergefields and includetexts. The
data source is in Excel. I want the users to be able to open automatically
via a macrobutton a new Word file based on my template when they finish enter
their source data and merge the information.
I have already managed to open an existing file via a macrobutton. I got the
following code from a post of Sept 2006 by moon. How can I elaborate on this
code to get a new file to open based on another template than normal.dot?

"Dim WRDAPP, WRDDOC
Set WRDAPP = CreateObject("Word.Application")
Set WRDDOC = WRDAPP.Documents.Open("C:\Security\Procesverbaal.d oc")
'Or for a new doc:
'Set WRDDOC = WRDAPP.Documents.Add

WRDAPP.Visible = True
'WRDAPP.Quit"
Regards, Lupe


Lupe

Open new Word file via Excel
 
Halim,
I have tested this, it opens the new document based on my template but the
toolbars for merging are missing.
Lupe

"Halim" wrote:

use this one maybe help
Dim WRDAPP, WRDDOC
Set WRDAPP = CreateObject("Word.Application")
'Or for a new doc:
Set WRDDOC = WRDAPP.Documents.Add _
Template:= "C:\Template\yourtmplate.doc"

WRDAPP.Visible = True
--
Regards,

Halim



"Lupe" wrote:

Hi
I've created a Word template with many mergefields and includetexts. The
data source is in Excel. I want the users to be able to open automatically
via a macrobutton a new Word file based on my template when they finish enter
their source data and merge the information.
I have already managed to open an existing file via a macrobutton. I got the
following code from a post of Sept 2006 by moon. How can I elaborate on this
code to get a new file to open based on another template than normal.dot?

"Dim WRDAPP, WRDDOC
Set WRDAPP = CreateObject("Word.Application")
Set WRDDOC = WRDAPP.Documents.Open("C:\Security\Procesverbaal.d oc")
'Or for a new doc:
'Set WRDDOC = WRDAPP.Documents.Add

WRDAPP.Visible = True
'WRDAPP.Quit"
Regards, Lupe


Halim

Open new Word file via Excel
 
add this one to your code

WRDDOC.CommandBars("mail merge").Visible = True

--
Regards,

Halim



"Lupe" wrote:

Halim,
I have tested this, it opens the new document based on my template but the
toolbars for merging are missing.
Lupe

"Halim" wrote:

use this one maybe help
Dim WRDAPP, WRDDOC
Set WRDAPP = CreateObject("Word.Application")
'Or for a new doc:
Set WRDDOC = WRDAPP.Documents.Add _
Template:= "C:\Template\yourtmplate.doc"

WRDAPP.Visible = True
--
Regards,

Halim



"Lupe" wrote:

Hi
I've created a Word template with many mergefields and includetexts. The
data source is in Excel. I want the users to be able to open automatically
via a macrobutton a new Word file based on my template when they finish enter
their source data and merge the information.
I have already managed to open an existing file via a macrobutton. I got the
following code from a post of Sept 2006 by moon. How can I elaborate on this
code to get a new file to open based on another template than normal.dot?

"Dim WRDAPP, WRDDOC
Set WRDAPP = CreateObject("Word.Application")
Set WRDDOC = WRDAPP.Documents.Open("C:\Security\Procesverbaal.d oc")
'Or for a new doc:
'Set WRDDOC = WRDAPP.Documents.Add

WRDAPP.Visible = True
'WRDAPP.Quit"
Regards, Lupe



All times are GMT +1. The time now is 08:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com