Saturday, May 30, 2009
Crosshatching in VBA for Microsoft Office 2007
The new versions of Microsoft Office don't natively support cross hatching anymore, not in Word or Powerpoint anyway.
So if you want to get lovely crosshatched diagrams and different patterns you can use this script I wrote. Just press view, macro, create a new one, paste in the code, then run it on your selected object. A great way to make venn diagrams with overlapping crosshatched regions in Powerpoint 2007!
Dim Sh As Shape
Dim oldFColor As Long
If Not ActiveWindow.Selection.Type = ppSelectionShapes Then
MsgBox "Select something, then try again"
Set Sh = ActiveWindow.Selection.ShapeRange(1)
strMenu = "Select pattern: 1. Horizontal, 2. Vertical, 3. Upward Diagonal, 4. Downward Diagonal "
rc = InputBox(strMenu, "Menu", 1)
If IsNumeric(rc) Then
Select Case rc
p = msoPatternHorizontal
p = msoPatternVertical
p = msoPatternUpwardDiagonal
p = msoPatternDownwardDiagonal
MsgBox "Invalid Selection"
.Transparency = 0.5
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 0, 0)
.BackColor.RGB = RGB(255, 255, 255)