Printing DOC Bypass readonly popup

meano

New Member
Joined
Apr 18, 2011
Messages
2
I print my worksheet and a word doc that go with my worksheet.
I would like to bypass the readonly popup I get for the word doc.
Can i code in my password so i will not get the popup or what is the best way not to get the readonly box for word.

Here is the code i have now.

Private Sub CommandButton1_Click()
ThisWorkbook.Worksheets("LOTO").PrintOut

Set wrdApp = CreateObject("Word.Application")
Set wrdDoc = wrdApp.Documents.Open _
("C:\CBF Operations\CBF LOTO PROGRAM\LOTO PROCEDURES
\FILTERS\WEST TEXAS RAW FILTERS NORTH .doc")

wrdDoc.PrintOut
wrdDoc.Close
wrdApp.Quit
End Sub
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
I found what works here it is

Private Sub CommandButton1_Click()
ThisWorkbook.Worksheets("LOTO").PrintOut

SetAttr "C:\path of doc\test.doc", vbReadOnly + vbHidden
Set wrdApp = CreateObject("Word.Application")
Set wrdDoc = wrdApp.Documents.Open _
("C:\path of doc\test.doc")

wrdDoc.PrintOut
wrdDoc.Close
wrdApp.Quit

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,559
Messages
6,179,513
Members
452,921
Latest member
BBQKING

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
Back
Top