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

Hi,

I would like to check whether how to control open, print and close a Word
document say, 'quotation.doc' from Excel.

I need to perform this operation because I have to do my detailed
calculations in Excel in order to derive at a final quotation price,
afterwhich dump this price on a Word template (quotation.doc) and print the
quotation out.

Thank you.



Ringo Tan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 212
Default Printing a Word document from Excel spreadsheet

In excel first add reference to "Mocrosoft Word xx.x Object Library"
Then:-

Sub WdocPrinter()
Dim appWD As Word.Application, myPath As String
myPath = "C:\My Documents" 'Set the path for your quotation.doc file
Set appWD = CreateObject("Word.Application")
appWD.Documents.Open Filename:=myPath & "\quotation.doc"
With appWD.ActiveDocument
.PrintOut
.Close
End With
End Sub

Sharad

"ringo tan" wrote in message
...
Hi,

I would like to check whether how to control open, print and close a Word
document say, 'quotation.doc' from Excel.

I need to perform this operation because I have to do my detailed
calculations in Excel in order to derive at a final quotation price,
afterwhich dump this price on a Word template (quotation.doc) and print
the
quotation out.

Thank you.



Ringo Tan



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Printing a Word document from Excel spreadsheet

Hi Sharad,

Thank you for your kind help but i dont know how to add the reference
"Microsoft Word xx.x Object Library" in Excel?

Thank you



"Sharad Naik" wrote:

In excel first add reference to "Mocrosoft Word xx.x Object Library"
Then:-

Sub WdocPrinter()
Dim appWD As Word.Application, myPath As String
myPath = "C:\My Documents" 'Set the path for your quotation.doc file
Set appWD = CreateObject("Word.Application")
appWD.Documents.Open Filename:=myPath & "\quotation.doc"
With appWD.ActiveDocument
.PrintOut
.Close
End With
End Sub

Sharad

"ringo tan" wrote in message
...
Hi,

I would like to check whether how to control open, print and close a Word
document say, 'quotation.doc' from Excel.

I need to perform this operation because I have to do my detailed
calculations in Excel in order to derive at a final quotation price,
afterwhich dump this price on a Word template (quotation.doc) and print
the
quotation out.

Thank you.



Ringo Tan




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 212
Default Printing a Word document from Excel spreadsheet

In a Visual Basic Editor, click on Tools menu and select references.
References window appears.
Scroll down and find 'Microsoft Word 11.0 Object Library'' (depending upon
your version it might not be 11.0, something else, hence I put xx.x.)
Check the box fot that library and click on OK.

Sharad

"ringo tan" wrote in message
...
Hi Sharad,

Thank you for your kind help but i dont know how to add the reference
"Microsoft Word xx.x Object Library" in Excel?

Thank you



"Sharad Naik" wrote:

In excel first add reference to "Mocrosoft Word xx.x Object Library"
Then:-

Sub WdocPrinter()
Dim appWD As Word.Application, myPath As String
myPath = "C:\My Documents" 'Set the path for your quotation.doc
file
Set appWD = CreateObject("Word.Application")
appWD.Documents.Open Filename:=myPath & "\quotation.doc"
With appWD.ActiveDocument
.PrintOut
.Close
End With
End Sub

Sharad

"ringo tan" wrote in message
...
Hi,

I would like to check whether how to control open, print and close a
Word
document say, 'quotation.doc' from Excel.

I need to perform this operation because I have to do my detailed
calculations in Excel in order to derive at a final quotation price,
afterwhich dump this price on a Word template (quotation.doc) and print
the
quotation out.

Thank you.



Ringo Tan






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Printing a Word document from Excel spreadsheet

Another option that maybe be safer (you won't have to worry about different
versions of word):

Just change this line:
Dim appWD As Word.Application, myPath As String
to
Dim appWD As Object, myPath As String

This is called late binding. Excel will figure out what you want from the
createobject() line.

When you do this: "Dim appWD As Word.Application", it's called early
binding--you're telling excel that you'll handle the details.

Early binding is nice for development (and it's slightly quicker
(unnoticeable???), but with late binding you don't have to worry about
supporting multiple versions of office.

(and it's an easy change!)

ringo tan wrote:

Hi Sharad,

Thank you for your kind help but i dont know how to add the reference
"Microsoft Word xx.x Object Library" in Excel?

Thank you

"Sharad Naik" wrote:

In excel first add reference to "Mocrosoft Word xx.x Object Library"
Then:-

Sub WdocPrinter()
Dim appWD As Word.Application, myPath As String
myPath = "C:\My Documents" 'Set the path for your quotation.doc file
Set appWD = CreateObject("Word.Application")
appWD.Documents.Open Filename:=myPath & "\quotation.doc"
With appWD.ActiveDocument
.PrintOut
.Close
End With
End Sub

Sharad

"ringo tan" wrote in message
...
Hi,

I would like to check whether how to control open, print and close a Word
document say, 'quotation.doc' from Excel.

I need to perform this operation because I have to do my detailed
calculations in Excel in order to derive at a final quotation price,
afterwhich dump this price on a Word template (quotation.doc) and print
the
quotation out.

Thank you.



Ringo Tan





--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 212
Default Printing a Word document from Excel spreadsheet

Thanks Dave :)
"Dave Peterson" wrote in message
...
Another option that maybe be safer (you won't have to worry about
different
versions of word):

Just change this line:
Dim appWD As Word.Application, myPath As String
to
Dim appWD As Object, myPath As String

This is called late binding. Excel will figure out what you want from the
createobject() line.

When you do this: "Dim appWD As Word.Application", it's called early
binding--you're telling excel that you'll handle the details.

Early binding is nice for development (and it's slightly quicker
(unnoticeable???), but with late binding you don't have to worry about
supporting multiple versions of office.

(and it's an easy change!)

ringo tan wrote:

Hi Sharad,

Thank you for your kind help but i dont know how to add the reference
"Microsoft Word xx.x Object Library" in Excel?

Thank you

"Sharad Naik" wrote:

In excel first add reference to "Mocrosoft Word xx.x Object Library"
Then:-

Sub WdocPrinter()
Dim appWD As Word.Application, myPath As String
myPath = "C:\My Documents" 'Set the path for your quotation.doc
file
Set appWD = CreateObject("Word.Application")
appWD.Documents.Open Filename:=myPath & "\quotation.doc"
With appWD.ActiveDocument
.PrintOut
.Close
End With
End Sub

Sharad

"ringo tan" wrote in message
...
Hi,

I would like to check whether how to control open, print and close a
Word
document say, 'quotation.doc' from Excel.

I need to perform this operation because I have to do my detailed
calculations in Excel in order to derive at a final quotation price,
afterwhich dump this price on a Word template (quotation.doc) and
print
the
quotation out.

Thank you.



Ringo Tan




--

Dave Peterson



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
Excel - Printing a page that contains an Embedded Word Document JLMHoss Excel Discussion (Misc queries) 2 July 22nd 08 09:56 PM
Problems printing a word document with linked excel tables. jcarlos Excel Discussion (Misc queries) 0 August 30th 05 04:01 PM
Printing Word Document using Excel Programming hangs Word Alan Excel Programming 0 September 30th 04 08:41 PM
Printing a Word document from an excel macro Mike_Shimandle Excel Programming 1 September 30th 04 04:13 PM
Printing a Word document from an excel macro mshimandle Excel Programming 0 September 30th 04 04:07 PM


All times are GMT +1. The time now is 05:32 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"