NEED VBA Guidance

L

LadyMiss22

I'm working with a teacher to create a booklet. She has two pages one for
the teacher with answers in a table and another for the student with blank
spaces in tables and an upside down word art with the answers.

I want to combine these into one document and be able to press CTRL + M to
turn a macro on and off that would clear the contents of the tables so that
she can print it out for students but then upon pressing CTRL + M again have
what she entered restored.

Is this possible?
 
G

Graham Mayor

If you want to hide a column of text it would be simpler to have it as
ordinary text and not Word Art. In that case you could use the following
macros to toggle the hidden text display and to print the document without
the text displayed.

Sub ToggleHidden()
With ActiveWindow.View
.ShowHiddenText = Not .ShowHiddenText
End With
End Sub

Sub PrintDoc()
Dim bPrintHidden As Boolean
bPrintHidden = Options.PrintHiddenText
Options.PrintHiddenText = False
ActiveDocument.PrintOut
Options.PrintHiddenText = bPrintHidden
End Sub

You could combine the macros

Sub ToggleHidden()
Dim bPrintHidden As Boolean
Dim qPrint As String
Dim Msg As String
bPrintHidden = Options.PrintHiddenText
With ActiveWindow.View
.ShowHiddenText = Not .ShowHiddenText
End With
If ActiveWindow.View.ShowHiddenText = False Then
Options.PrintHiddenText = False
Msg = "Hidden Text Hidden"
Else
Options.PrintHiddenText = True
Msg = "Hidden Text Displayed"
End If
qPrint = MsgBox("Print document with " & Msg, vbYesNo, "Print")
If qPrint = vbYes Then
GoTo PrintDoc:
Else
Options.PrintHiddenText = bPrintHidden
End If
Exit Sub
PrintDoc:
ActiveDocument.PrintOut
Options.PrintHiddenText = bPrintHidden
End Sub

However if for some reason you need the Word Art, how is the document
arranged?
Do you gave each Word Art object in a table cell? In column 2?
Is the Word Art inserted In Line or did you change the wrap option in order
to invert it?
Why CTRL+M? This keyboard shortcut is already assigned in Word. Add the
macro(s) to a toolbar button or unused keyboard shortcut.


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
L

LadyMiss22

Thanks for your response Graham!! :) Basically I want to clear contents of
some cells in a table and have a word art box appear and disappear.

I guess I must elaborate a little bit more. Basically what she has is two
work documents that serve as Quizzes with two tables in each.

The first table has one row, three cells. Cells 1 & 3 have the answers.
The second table has one row, two cells with both having answers. I have
them positioned around a circle diagram because I thought this would be
easier to enter/edit than text boxes.

She has the questions and answers filled in on one of the docs. Then on the
second the "answer" cells are blank. Additionally I created a word art box
at the bottom right hand corner with the wrap changed to 'behind text' with
the answers upside down on the page, this was the only way I figured I could
turn text upside down while still being able to edit it. It's independent
from the tables. Wish there was a way to show but anyway, she wants to be
able to type in her answers then print.. then have an on/off macro assigned
to a short cut key that when pressed would clear the "answers" cells and have
the Word art box appear so that she can print a copy for the student.. I
just randomly chose CTRL +M, no reason for it!
 
G

Graham Mayor

If you can send me a copy of the document to the link on the home page of my
web site I will have a look at it.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
L

LadyMiss22

You are awesome. I will do so this afternoon.
Graham Mayor said:
If you can send me a copy of the document to the link on the home page of my
web site I will have a look at it.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Graham Mayor

Unfortunately the document I received was corrupt. Can you resend it -
preferably zipped.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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