Re: Run one macro from another and edit filenames for PDF printing
- From: Dan B <DanB@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 7 Mar 2008 02:42:01 -0800
Thanks Graham - really appreciate it.
Would you say that Word 2007 makes life easier in terms of macro development
and general use? Maybe I should push the boss for an upgrade.
"Graham Mayor" wrote:
I was afraid you might be using Word 2003 ;) Leave it with me for a bit..
I'll have a play around.
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Dan B wrote:
The code I'm using to 'hide' the answers is actually just adjusting
the font colour of all text in text boxes (from dark grey to white):
Sub HideAnswers()
' Find each text box and set it's font colour to white
Dim aShape As Shape
For Each aShape In ActiveDocument.Shapes
If aShape.Type = msoTextBox Then
With aShape
If .TextFrame.HasText Then
.TextFrame.TextRange.Font.Color = wdColorWhite
End If
End With
End If
Next
End Sub
To show the answers I use another macro to do the reverse (change font
colour in text boxes from white back to grey).
I'm using Word 2003 and ideally I will need the solution to work on
Word XP.
Cheers,
Dan.
"Graham Mayor" wrote:
I looked at this late yesterday and decided that it lacked an
essential bit of information that I was going to come back to this
morning.
3) Hide the answers using macro built into doc.
I think we need to know more about how the documents are hidden in
order to create a seamless process; other than that I was working
along the same lines to create a temporary folder to catch the
documents in order to allow Acrobat to create the PDFs using the
file names, but it should be possible to use the macro to generate
the file names (if I knew a bit more about the Acrobat object model)
I also wondered at the Word version as this is altogether much
easier in Word 2007 which can *save* documents in PDF format, thus
making the naming easier and avoiding the use of the print function
altogether.
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Jean-Guy Marcil wrote:
"Dan B" wrote:
Hi.
I have a series of question / answer sheets as word docs. Each Word
doc has macros to show or hide answers. My intention is perform a
batch process to all docs as follows:
1) Open doc.
2) Print to PDF (answers showing by default) using word doc
filename as PDF filename.
3) Hide the answers using macro built into doc.
4) Print a second PDF using word doc filename (but replace the last
character 'a' with 'q') as PDF filename.
Here is one way of going about it:
Declare a document object, like:
Dim docProcess As Document
Once your code has made sure that there are documents to process,
create a sub directory for the Student versions
(parentDirectory\Student)
Use the doc object to open the first doc in the list:
Set docProcess= Documents.Open(DocList)
Use the doc to do the processing:
With docProcess
.Printout
.etc
End With
Since the easiest way to gt the PDF name is to ge it from the Word
doc, I would recommend doing a Save As with the suffix you want to
the new Student subdirectory.
Run the macro in that new doc by using something like:
ProjectName.ModuleName.SubName
Create the PDF.
Close the document.
Delete this doc document.
Repeat and rinse.
This way, when you are done, you will have a sub directory with the
PDF Question documents attached to the parent directory which will
contain both the PDF and the Word Answer ***.
This solution will require more code than I have time to write right
now. You may try and ask specific questions with the parts you are
having problems with.
Or course, someone will drop in with a much simpler solution... I
always complicate things...
- Follow-Ups:
- Re: Run one macro from another and edit filenames for PDF printing
- From: Graham Mayor
- Re: Run one macro from another and edit filenames for PDF printing
- References:
- Run one macro from another and edit filenames for PDF printing
- From: Dan B
- RE: Run one macro from another and edit filenames for PDF printing
- From: Jean-Guy Marcil
- Re: Run one macro from another and edit filenames for PDF printing
- From: Graham Mayor
- Re: Run one macro from another and edit filenames for PDF printing
- From: Dan B
- Re: Run one macro from another and edit filenames for PDF printing
- From: Graham Mayor
- Run one macro from another and edit filenames for PDF printing
- Prev by Date: Re: How know ID for some commands that is in the "Clipboard" group on the "Home" tab (Word 2007)?
- Next by Date: Re: Run one macro from another and edit filenames for PDF printing
- Previous by thread: Re: Run one macro from another and edit filenames for PDF printing
- Next by thread: Re: Run one macro from another and edit filenames for PDF printing
- Index(es):
Loading