Print word document from excel

Status
Not open for further replies.

littleguy1810

New Member
Joined
Aug 21, 2014
Messages
40
Hi

A great guy has been helping me with this code(Macropod) could someone help me with this as he is offline, ?I get an error msg when trying to run it. Error code 91? Object variable or with block variable not set.

Thanks





Code:
Dim wdApp As New Word.Application, wdDoc As Word.DocumentSet wdDoc = wdApp.Documents.Open(Filename:=ActiveWorkbook.Path & "T:\Quality Management System\Section 7 Personnel\07.004 Animal Feed Jan16.docx", _
  ReadOnly:=True, AddToRecentFiles:=False)
With wdDoc
  .PrintOut
  .Close , False
End With
wdApp.Quit
Set wdDoc = Nothing: Set wdApp = Nothing
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

yky

Well-known Member
Joined
Jun 7, 2011
Messages
1,881
Office Version
  1. 2010
Platform
  1. Windows
Did the open method actually open the file (" wdApp.Documents.Open(Filename:=ActiveWorkbook.Path & "T:\Qu....")? I'm asking the question because it seems odd to have a path followed by a drive letter (ActiveWorkbook.Path & "T:\...").
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,191,706
Messages
5,988,188
Members
440,138
Latest member
yanaa

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