Hello,
Yesterday the Word Heretic (Steve Hudson) posted a macro for killing
footnotes. I have bumbled along for the last hour or so trying to adapt his
simple code to allow the user to input what he/wants to kill. I have tried
String, Range, Long, Object and several others where the ???? appears below
and I keep getting one error code or another about type mismatch, object not
set, and on and on.
Would one of you have a look and see if you can steer me back on course?
Thanks
Sub KillAnything()
Dim myThing As ?????
Title = "Kill Box"
Message = "Type the object name of the thing you want to kill e.g., Fields,
Shapes, etc."
myThing = InputBox(Message, Title)
'Even better would be a InputBox with radio buttons listing common objects
With ActiveDocument.myThing
While .Count > 0
.Item(1).Delete
Wend
End With
End Sub

Signature
Greg Maxey
A peer in "peer to peer" support
Rockledge, FL
To e-mail, edit out the "w...spam" in gmaxey@whamspammvps.org
Word Heretic - 31 Jan 2004 06:06 GMT
G'day "Greg Maxey" <gmaxey@whamspammvps.org>,
VARIANT
Steve Hudson
Word Heretic Sydney Australia
Tricky stuff with Word or words
Email: WordHeretic at tpg.com.au
Greg Maxey was spinning this yarn:
>Hello,
>
[quoted text clipped - 22 lines]
>
>End Sub
Greg Maxey - 31 Jan 2004 06:21 GMT
I stand corrected.

Signature
Greg Maxey
A peer in "peer to peer" support
Rockledge, FL
To e-mail, edit out the "w...spam" in gmaxey@whamspammvps.org
> G'day "Greg Maxey" <gmaxey@whamspammvps.org>,
>
[quoted text clipped - 34 lines]
>>
>> End Sub
Peter Hewett - 31 Jan 2004 07:10 GMT
Hi Greg
I don't know of a way to do what you want.
The code "myThing = InputBox(Message, Title)" is ALWAYS going to assign a
string to myThing, not an object of the type you are specifying in the
InputBox. Also the statement "ActiveDocument.myThing" isn't going to work
as it will expect myThing to be a Property or Method of the Document
object.
When you assign objects to a Variant, the Variant essentially just acts as
a pointer to a pre-existing object. You can't assign a non instantiated
class to a Variant.
If you could get it working you've also assumed that all objects are
Properties/Methods of the Document object. Take Cells for example, the
parent object of a Cell is always a Table.
You might be able to put something together using an extensive Case
statement.
HTH + Cheers - Peter
"Greg Maxey" <gmaxey@whamspammvps.org> wrote in news:jPHSb.67701$Bj.6160
@twister.tampabay.rr.com:
> From: "Greg Maxey" <gmaxey@whamspammvps.org>
> Subject: Re: Variation to a Word Heretic Macro
[quoted text clipped - 40 lines]
>>>
>>> End Sub
Greg Maxey - 31 Jan 2004 12:43 GMT
Peter,
>You might be able to put something together using an extensive Case
statement.
Brain surgery would likely be more doable fo me :-)
Thanks for the explanation. The whole point of the experiment was to learn
something and I have accomplished that regardless of the final state of the
macro. I was even reminded that Variant is a better word than Variation for
the subject.
Thanks.

Signature
Greg Maxey
A peer in "peer to peer" support
Rockledge, FL
To e-mail, edit out the "w...spam" in gmaxey@whamspammvps.org
Peter Hewett wrote: You might be able to put something together using an
extensive Case
> statement.
> Hi Greg
>
[quoted text clipped - 70 lines]
>>>>
>>>> End Sub
Word Heretic - 31 Jan 2004 13:18 GMT
G'day "Greg Maxey" <gmaxey@whamspammvps.org>,
LOL - you are in form today.
Dim Something as Variant
Set Something = ActiveDocument
Set Something = Selection
Set Something = ...
Steve Hudson
Word Heretic Sydney Australia
Tricky stuff with Word or words
Email: WordHeretic at tpg.com.au
Greg Maxey was spinning this yarn:
>Peter,
>
[quoted text clipped - 9 lines]
>
>Thanks.
Greg Maxey - 31 Jan 2004 15:00 GMT
Steve,
Glad I made you laugh.
I tried, but don't know enough about VBA to do anything with the hints you
have provided.
Thanks just the same.

Signature
Greg Maxey
A peer in "peer to peer" support
Rockledge, FL
To e-mail, edit out the "w...spam" in gmaxey@whamspammvps.org
> G'day "Greg Maxey" <gmaxey@whamspammvps.org>,
>
[quoted text clipped - 27 lines]
>>
>> Thanks.