macro to print & change color

S

Sin

Can I create a marco in words where it will change all table colors to white
and print the document?
 
J

Jean-Guy Marcil

Sin was telling us:
Sin nous racontait que :
Can I create a marco in words where it will change all table colors
to white and print the document?

Yes.

But what do you mean by table colors?
The borders? The fill? Both? The text as well?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
S

Sin

The fill (background color)

Jean-Guy Marcil said:
Sin was telling us:
Sin nous racontait que :


Yes.

But what do you mean by table colors?
The borders? The fill? Both? The text as well?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
J

Jean-Guy Marcil

Sin was telling us:
Sin nous racontait que :
The fill (background color)

OK, and should this change be permanent, or should the tables return to
their original colours after printing?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
J

Jean-Guy Marcil

Sin was telling us:
Sin nous racontait que :
The tables are to return to it's original color after printing
Try this to get you started... And I hope that next time, try to think of
all the relevant details when posting a query... you will then get a much
faster reply that will also be more accurate according to your needs... ;-)

Sub PrintTableNoColour()

Dim tblCurrent As Table
Dim lngUndoCount As Long
Dim rgeStart As Range

Set rgeStart = Selection.Range

'Set to false to make code run faster
'In case of large document with many tables
Application.ScreenUpdating = False

lngUndoCount = 0
For Each tblCurrent In ActiveDocument.Tables
tblCurrent.Shading.BackgroundPatternColor = wdColorWhite
lngUndoCount = lngUndoCount + 1
Next

With Application
'Reset to true or if user moves dialog around,
'there wil be traces on the screen
.ScreenUpdating = True
.Dialogs(wdDialogFilePrint).Show
.ScreenUpdating = False

ActiveDocument.Undo lngUndoCount

rgeStart.Select

.ScreenRefresh
.ScreenUpdating = True
End With

End Sub

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
S

Sin

Sorry, I didn't think it through carefully

Thank you so much, the code works great.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top