Hi
As part of the company rebranding exercise, we have been asked to change the front cover on our templates. Basically, the backdrop needs to be randomly generated with different colours when the document is *created*. More details in the attachment.
Any ideas highly welcomed. Thanks.
Robie.
EDIT: This will most likely be used with Windows 7 and Office 2007/2010 or Office 2003.
Randomly changeable front cover
-
- 5StarLounger
- Posts: 656
- Joined: 18 Feb 2010, 14:26
Randomly changeable front cover
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78574
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Randomly changeable front cover
Keep in mind that most printers don't allow printing right up to the edge of the paper, and that printing solid blocks of colour uses up enormous amounts of toner and often produces disappointing results. It'd be better to buy coloured paper if the right design is available, or have it produced for you by a professional print shop. You can then print text on top of the coloured cover paper.
Best wishes,
Hans
Hans
-
- Administrator
- Posts: 12618
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: Randomly changeable front cover
You could give the colored triangle a name and then set the forecolor of that object in a document_new procedure associated with the template.
This won't help if people simply copy an existing front cover to use.
I have uploaded a template in a zip file for you to play with.
Code: Select all
Private Sub Document_New()
Select Case Int(Rnd * 6)
Case 1
ActiveDocument.Shapes("shpColorTriangle").Fill.ForeColor = RGB(127, 255, 0)
Case 2
ActiveDocument.Shapes("shpColorTriangle").Fill.ForeColor = RGB(127, 0, 255)
Case 3
ActiveDocument.Shapes("shpColorTriangle").Fill.ForeColor = RGB(0, 127, 255)
Case 4
ActiveDocument.Shapes("shpColorTriangle").Fill.ForeColor = RGB(0, 255, 127)
Case 5
ActiveDocument.Shapes("shpColorTriangle").Fill.ForeColor = RGB(255, 0, 127)
Case 6
ActiveDocument.Shapes("shpColorTriangle").Fill.ForeColor = RGB(0, 60, 60)
End Select
End Sub
I have uploaded a template in a zip file for you to play with.
You do not have the required permissions to view the files attached to this post.
StuartR
-
- 5StarLounger
- Posts: 656
- Joined: 18 Feb 2010, 14:26
Re: Randomly changeable front cover
Thanks Hans. My argument exactly with the management but they are adamant that they want this. Personally, I would prefer it without this mess of solid blocks & as you say it does use of lots of toner.HansV wrote:Keep in mind that most printers don't allow printing right up to the edge of the paper, and that printing solid blocks of colour uses up enormous amounts of toner and often produces disappointing results. It'd be better to buy coloured paper if the right design is available, or have it produced for you by a professional print shop. You can then print text on top of the coloured cover paper.
-
- 5StarLounger
- Posts: 656
- Joined: 18 Feb 2010, 14:26
Re: Randomly changeable front cover
Thanks Stuart, I think you are on to a winner here. I will certainly play with your template.StuartR wrote:You could give the colored triangle a name and then set the forecolor of that object in a document_new procedure associated with the template.This won't help if people simply copy an existing front cover to use.Code: Select all
Private Sub Document_New() Select Case Int(Rnd * 6) Case 1 ActiveDocument.Shapes("shpColorTriangle").Fill.ForeColor = RGB(127, 255, 0) Case 2 ActiveDocument.Shapes("shpColorTriangle").Fill.ForeColor = RGB(127, 0, 255) Case 3 ActiveDocument.Shapes("shpColorTriangle").Fill.ForeColor = RGB(0, 127, 255) Case 4 ActiveDocument.Shapes("shpColorTriangle").Fill.ForeColor = RGB(0, 255, 127) Case 5 ActiveDocument.Shapes("shpColorTriangle").Fill.ForeColor = RGB(255, 0, 127) Case 6 ActiveDocument.Shapes("shpColorTriangle").Fill.ForeColor = RGB(0, 60, 60) End Select End Sub
I have uploaded a template in a zip file for you to play with.
This sounds like a really good solution to me apart from the creation and adding of the triangular shape. But, I will look into that - google will be my best friend for a while :0).
-
- Administrator
- Posts: 12618
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: Randomly changeable front cover
I created the three shapes manually, and then set the name of the third shape using the Visual Basic immediate window.Robie wrote:...This sounds like a really good solution to me apart from the creation and adding of the triangular shape...
Because I had created exactly three shapes, I just used the command
ActiveDocument.Shapes(3).Name = "shpColorTriangle"
StuartR
-
- SilverLounger
- Posts: 2403
- Joined: 05 Feb 2010, 22:21
- Location: London ENGLAND
Re: Randomly changeable front cover
Won't Int(Rnd*6) produce a number between 0 and 5? It's a little neater (more efficient) to nest the Select.. Case within a With structure:
Code: Select all
Private Sub Document_New()
With ActiveDocument.Shapes("shpColorTriangle").Fill
Select Case Int(Rnd * 6 + 1)
Case 1
.ForeColor = RGB(127, 255, 0)
Case 2
.ForeColor = RGB(127, 0, 255)
Case 3
.ForeColor = RGB(0, 127, 255)
Case 4
.ForeColor = RGB(0, 255, 127)
Case 5
.ForeColor = RGB(255, 0, 127)
Case 6
.ForeColor = RGB(0, 60, 60)
End Select
End With
End Sub
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
-
- Administrator
- Posts: 12618
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: Randomly changeable front cover
Yes, of course it will.agibsonsw wrote:Won't Int(Rnd*6) produce a number between 0 and 5?
Thanks for the corrections, that code is much better.agibsonw wrote:It's a little neater (more efficient) to nest the Select.. Case within a With structure:
StuartR
-
- 5StarLounger
- Posts: 656
- Joined: 18 Feb 2010, 14:26
Re: Randomly changeable front cover
Thank you all.
The solution you have provided works just wonderfully for me. You are all too good. A big THANKS.
The solution you have provided works just wonderfully for me. You are all too good. A big THANKS.