|
-
May 30th, 2006, 06:22 AM
#1
Thread Starter
Lively Member
Word Shapes
I am writing a vba macro to do several different things. One of which is to delete a defined shape out of a word document. Therein lies the problem. I have to identify the shape by dimension which should be all well and good, but some shapes are in a group of shapes and the dimensions dont match. So I was wondering, is there a way to have vba look at an image, determine if it is a shape and the go throught each individual image in the group?
If anyone can help me on this I would be most appreciative.
Thank You in advance.
Last edited by safewithyou247; May 30th, 2006 at 08:27 AM.
"A candle loses nothing by lighting another candle."
-
May 30th, 2006, 08:57 AM
#2
Thread Starter
Lively Member
Re: Word Shapes
Ok this is what I have so far. I need help in the places that I put comments.
VB Code:
Dim objWond As Shape
Dim vix As Integer
Dim vox As Integer
Dim i As Integer
Dim a As Integer
vox = ActiveDocument.Shapes.Count
i = 1
Do Until i = vox
'need if then statement to detemine if the shape is a group or not.
vix = ActiveDocument.Shapes(i).GroupItems.Count
a = 1
Do Until a = vix
With ActiveDocument.Shapes(i)
If .GroupItems(a).height = 365 And .GroupItems(a).width = 404 Then
'Need to be able to delete the shape in the group. I tried .GroupItems(a).delete and it didn't work
End If
End With
a = a + 1
Loop
'End if
i = i + 1
Loop
Last edited by safewithyou247; May 30th, 2006 at 09:00 AM.
"A candle loses nothing by lighting another candle."
-
May 30th, 2006, 10:57 AM
#3
Frenzied Member
Re: Word Shapes
I have only used Wordart once, and I manipulated them by giving them names. The following is a piece of code I use to apply a dummy watermark to a document.
Couldn't you do a similar thing, i.e. name each wordart you create ?
That way you could delete/set them to blank at will.
VB Code:
If passForm.Name = "frmInvoice" Then
With objWord
' Page 1
.ActiveDocument.Shapes("WordArt 6").Select
.Selection.ShapeRange.TextEffect.Text = " "
' Page 2
.ActiveDocument.Shapes("WordArt 8").Select
.Selection.ShapeRange.TextEffect.Text = " "
End With
Else
If Invoiced = True Then
' Page 1
.ActiveDocument.Shapes("WordArt 6").Select
.Selection.ShapeRange.TextEffect.Text = "Reprint"
' Page 2
.ActiveDocument.Shapes("WordArt 8").Select
.Selection.ShapeRange.TextEffect.Text = "Reprint"
Else
' Page 1
.ActiveDocument.Shapes("WordArt 6").Select
.Selection.ShapeRange.TextEffect.Text = "Not Invoiced"
' Page 2
.ActiveDocument.Shapes("WordArt 8").Select
.Selection.ShapeRange.TextEffect.Text = "Not Invoiced"
End If
End If
-
May 30th, 2006, 10:58 AM
#4
Frenzied Member
Re: Word Shapes
oops !
Just realised I have read one thread and answered another ! ha ha !!! I need more coffee !
-
Nov 4th, 2006, 01:44 PM
#5
New Member
Re: Word Shapes
To determine if a shape is a group test the TYPE property of the shape against the msoGroup constant (grange is a shape object):
If grange.Type = msoGroup Then
MsgBox "Group"
End If
Sorry I can't be much help on the other part. I'm having some trouble with methods related to grouped shapes. If I stumble onto a solution, I'll be happy to pass it along.
SilentKnight
-
Nov 6th, 2006, 04:04 AM
#6
Frenzied Member
Re: Word Shapes
Did you realise this thread is 6 months old ?
I had to wonder what my input on it was when the email came through.
-
Nov 6th, 2006, 11:05 AM
#7
New Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|