Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Word document from template

I want to open from excel and VBA a Word instance with a document from word
templates.

I try this:

MyAppID = Shell _
("C:\Program Files\Microsoft Office\Office11\Winword.EXE C:\OFERTA.dot", 1)
AppActivate MyAppID

but this open the template himself not a document based on this template.

Thank you in advance.
Toni


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Word document from template

Sub nanann(
Dim WrdApp As Word.Applicatio
Dim WrdDoc As Word.Documen

Set WrdApp = CreateObject("Word.Application"
Set WrdDoc = WrdApp.Documents.Add("YourTemplate"
'other operation
WrdDoc.Close SaveChanges:=Fals
WrdApp.Quit
Set WrdDoc = Nothin
Set WrdApp = Nothin
End Su

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Word document from template

"Enescu Gabriel" wrote in message ...
I want to open from excel and VBA a Word instance with a document from word
templates.

I try this:

MyAppID = Shell _
("C:\Program Files\Microsoft Office\Office11\Winword.EXE C:\OFERTA.dot", 1)
AppActivate MyAppID

but this open the template himself not a document based on this template.

Thank you in advance.
Toni


Try the following:

Sub CreateWordDocFromTemplate()
'Excel VBA to create a new Word document from a Word template.
'Requires reference to Microsoft Word n.n Object Library.

Dim wdApp As Word.Application

On Error Resume Next
Set wdApp = GetObject(, "Word.Application")
If Err Then
Set wdApp = New Word.Application
End If
On Error GoTo 0

wdApp.Visible = True
wdApp.Activate

wdApp.Documents.Add "My Template.dot"

Set wdApp = Nothing

End Sub


the template is located in the default Word templates folder.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I convert an Excel document to a Word Document has3801 Setting up and Configuration of Excel 1 June 11th 08 11:16 PM
convert excel document to word document (not a picture) frendabrenda1 Excel Discussion (Misc queries) 2 October 6th 06 03:55 PM
link excel data to word document template Haz Excel Worksheet Functions 0 July 15th 06 06:29 PM
How do I convert a word document into a Excel document gwiltz2 Excel Discussion (Misc queries) 1 October 22nd 05 07:04 PM
How to change a excel document into a word document? wannaknow Excel Discussion (Misc queries) 1 July 27th 05 09:37 PM


All times are GMT +1. The time now is 04:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"