Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
eb eb is offline
external usenet poster
 
Posts: 24
Default Delete Word table with macro

Hello,

I have a macro that should be deleting 2 tables in my document plus a logo.
I got it to delete one table, but i cant seem to get it to delete both tables
and the logo. The code looks like this: ActiveDocument.Tables(1).Delete

what is the proper code to get the macro to delete all tables in the
document plus the logo?

any help is appreciated.
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
RichN RichN is offline
external usenet poster
 
Posts: 6
Default Delete Word table with macro

One way - and this assumes there is some text after the 2 tables and the logo
- would be to write the macro so that you use "Find" to go to the spot before
the 1st table, then use "Find" again to go to the spot after the 2nd table
and logo.

"EB" wrote:

Hello,

I have a macro that should be deleting 2 tables in my document plus a logo.
I got it to delete one table, but i cant seem to get it to delete both tables
and the logo. The code looks like this: ActiveDocument.Tables(1).Delete

what is the proper code to get the macro to delete all tables in the
document plus the logo?

any help is appreciated.

  #3   Report Post  
Posted to microsoft.public.word.docmanagement
eb eb is offline
external usenet poster
 
Posts: 24
Default Delete Word table with macro

Ok, I'm not sure how to write that macro since I'm new to macros. I've been
recording and then trying to edit the code. I found this one that is supposed
to delete the last table, but I cant figure out how to edit it so that it
deletes all of the tables plus the logo. this is the code:

Dim nTables As Integer
nTables = ActiveDocument.Tables.Count
ActiveDocument.Tables(nTables).Delete

"RichN" wrote:

One way - and this assumes there is some text after the 2 tables and the logo
- would be to write the macro so that you use "Find" to go to the spot before
the 1st table, then use "Find" again to go to the spot after the 2nd table
and logo.

"EB" wrote:

Hello,

I have a macro that should be deleting 2 tables in my document plus a logo.
I got it to delete one table, but i cant seem to get it to delete both tables
and the logo. The code looks like this: ActiveDocument.Tables(1).Delete

what is the proper code to get the macro to delete all tables in the
document plus the logo?

any help is appreciated.

  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Lene Fredborg Lene Fredborg is offline
external usenet poster
 
Posts: 1,291
Default Delete Word table with macro

The macro below will delete all tables in the active document:

Sub DeleteAllTables()

Dim oTable As Table

For Each oTable In ActiveDocument.Tables
oTable.Delete
Next oTable

End Sub

Note that your macro could be adjusted to delete all tables too (in the
current version, it will delete only the last table).

How to delete the logo depends on how and where it is inserted:
Is it €śIn line with text€ť or floating?
Is it in the main body of the document or, e.g., in the header?
Are there other graphics (drawings, pictures, etc.) in the document?

If the logo is the only graphic, inserted in the main body of the document
and "In line with text" (i.e. in the text layer of the document), the
following code line could be used to remove it:

ActiveDocument.InlineShapes(1).delete

If the wrapping style is any other than €śIn line with text€ť (i.e. the logo
is in the drawings layer of the document), you need to use €śShapes€ť instead
of €śInlineShapes€ť:

ActiveDocument.Shapes(1).delete

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word


"EB" wrote:

Ok, I'm not sure how to write that macro since I'm new to macros. I've been
recording and then trying to edit the code. I found this one that is supposed
to delete the last table, but I cant figure out how to edit it so that it
deletes all of the tables plus the logo. this is the code:

Dim nTables As Integer
nTables = ActiveDocument.Tables.Count
ActiveDocument.Tables(nTables).Delete

"RichN" wrote:

One way - and this assumes there is some text after the 2 tables and the logo
- would be to write the macro so that you use "Find" to go to the spot before
the 1st table, then use "Find" again to go to the spot after the 2nd table
and logo.

"EB" wrote:

Hello,

I have a macro that should be deleting 2 tables in my document plus a logo.
I got it to delete one table, but i cant seem to get it to delete both tables
and the logo. The code looks like this: ActiveDocument.Tables(1).Delete

what is the proper code to get the macro to delete all tables in the
document plus the logo?

any help is appreciated.

  #5   Report Post  
Posted to microsoft.public.word.docmanagement
eb eb is offline
external usenet poster
 
Posts: 24
Default Delete Word table with macro

Lane, The picture right now is set to In-line with text, however, I have
changed it a few times and I can still change it to accomodate the macro. I
will let you know how things worked out.

Thanks

"Lene Fredborg" wrote:

The macro below will delete all tables in the active document:

Sub DeleteAllTables()

Dim oTable As Table

For Each oTable In ActiveDocument.Tables
oTable.Delete
Next oTable

End Sub

Note that your macro could be adjusted to delete all tables too (in the
current version, it will delete only the last table).

How to delete the logo depends on how and where it is inserted:
Is it €śIn line with text€ť or floating?
Is it in the main body of the document or, e.g., in the header?
Are there other graphics (drawings, pictures, etc.) in the document?

If the logo is the only graphic, inserted in the main body of the document
and "In line with text" (i.e. in the text layer of the document), the
following code line could be used to remove it:

ActiveDocument.InlineShapes(1).delete

If the wrapping style is any other than €śIn line with text€ť (i.e. the logo
is in the drawings layer of the document), you need to use €śShapes€ť instead
of €śInlineShapes€ť:

ActiveDocument.Shapes(1).delete

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word


"EB" wrote:

Ok, I'm not sure how to write that macro since I'm new to macros. I've been
recording and then trying to edit the code. I found this one that is supposed
to delete the last table, but I cant figure out how to edit it so that it
deletes all of the tables plus the logo. this is the code:

Dim nTables As Integer
nTables = ActiveDocument.Tables.Count
ActiveDocument.Tables(nTables).Delete

"RichN" wrote:

One way - and this assumes there is some text after the 2 tables and the logo
- would be to write the macro so that you use "Find" to go to the spot before
the 1st table, then use "Find" again to go to the spot after the 2nd table
and logo.

"EB" wrote:

Hello,

I have a macro that should be deleting 2 tables in my document plus a logo.
I got it to delete one table, but i cant seem to get it to delete both tables
and the logo. The code looks like this: ActiveDocument.Tables(1).Delete

what is the proper code to get the macro to delete all tables in the
document plus the logo?

any help is appreciated.



  #6   Report Post  
Posted to microsoft.public.word.docmanagement
eb eb is offline
external usenet poster
 
Posts: 24
Default Delete Word table with macro

Lene,

Thanks for the help, I really appreciate it. I have one more question, I'm
trying to remove two words from my document. One is the word "Telephone" and
the other is "facsimile." I have been trying to add this to the code you
provided but I keep getting errors. Any ideas how I can remove those two
words?

thanks,

"Lene Fredborg" wrote:

The macro below will delete all tables in the active document:

Sub DeleteAllTables()

Dim oTable As Table

For Each oTable In ActiveDocument.Tables
oTable.Delete
Next oTable

End Sub

Note that your macro could be adjusted to delete all tables too (in the
current version, it will delete only the last table).

How to delete the logo depends on how and where it is inserted:
Is it €śIn line with text€ť or floating?
Is it in the main body of the document or, e.g., in the header?
Are there other graphics (drawings, pictures, etc.) in the document?

If the logo is the only graphic, inserted in the main body of the document
and "In line with text" (i.e. in the text layer of the document), the
following code line could be used to remove it:

ActiveDocument.InlineShapes(1).delete

If the wrapping style is any other than €śIn line with text€ť (i.e. the logo
is in the drawings layer of the document), you need to use €śShapes€ť instead
of €śInlineShapes€ť:

ActiveDocument.Shapes(1).delete

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word


"EB" wrote:

Ok, I'm not sure how to write that macro since I'm new to macros. I've been
recording and then trying to edit the code. I found this one that is supposed
to delete the last table, but I cant figure out how to edit it so that it
deletes all of the tables plus the logo. this is the code:

Dim nTables As Integer
nTables = ActiveDocument.Tables.Count
ActiveDocument.Tables(nTables).Delete

"RichN" wrote:

One way - and this assumes there is some text after the 2 tables and the logo
- would be to write the macro so that you use "Find" to go to the spot before
the 1st table, then use "Find" again to go to the spot after the 2nd table
and logo.

"EB" wrote:

Hello,

I have a macro that should be deleting 2 tables in my document plus a logo.
I got it to delete one table, but i cant seem to get it to delete both tables
and the logo. The code looks like this: ActiveDocument.Tables(1).Delete

what is the proper code to get the macro to delete all tables in the
document plus the logo?

any help is appreciated.

  #7   Report Post  
Posted to microsoft.public.word.docmanagement
Lene Fredborg Lene Fredborg is offline
external usenet poster
 
Posts: 1,291
Default Delete Word table with macro

Before I try to suggest a solution I would like to know a little mo
Are the two words found more than once - and in that case, do you want all
occurrences to be removed?
or
Are the two words found only once - maybe in a specific place in the document?

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word


"EB" wrote:

Lene,

Thanks for the help, I really appreciate it. I have one more question, I'm
trying to remove two words from my document. One is the word "Telephone" and
the other is "facsimile." I have been trying to add this to the code you
provided but I keep getting errors. Any ideas how I can remove those two
words?

thanks,

"Lene Fredborg" wrote:

The macro below will delete all tables in the active document:

Sub DeleteAllTables()

Dim oTable As Table

For Each oTable In ActiveDocument.Tables
oTable.Delete
Next oTable

End Sub

Note that your macro could be adjusted to delete all tables too (in the
current version, it will delete only the last table).

How to delete the logo depends on how and where it is inserted:
Is it €śIn line with text€ť or floating?
Is it in the main body of the document or, e.g., in the header?
Are there other graphics (drawings, pictures, etc.) in the document?

If the logo is the only graphic, inserted in the main body of the document
and "In line with text" (i.e. in the text layer of the document), the
following code line could be used to remove it:

ActiveDocument.InlineShapes(1).delete

If the wrapping style is any other than €śIn line with text€ť (i.e. the logo
is in the drawings layer of the document), you need to use €śShapes€ť instead
of €śInlineShapes€ť:

ActiveDocument.Shapes(1).delete

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word


"EB" wrote:

Ok, I'm not sure how to write that macro since I'm new to macros. I've been
recording and then trying to edit the code. I found this one that is supposed
to delete the last table, but I cant figure out how to edit it so that it
deletes all of the tables plus the logo. this is the code:

Dim nTables As Integer
nTables = ActiveDocument.Tables.Count
ActiveDocument.Tables(nTables).Delete

"RichN" wrote:

One way - and this assumes there is some text after the 2 tables and the logo
- would be to write the macro so that you use "Find" to go to the spot before
the 1st table, then use "Find" again to go to the spot after the 2nd table
and logo.

"EB" wrote:

Hello,

I have a macro that should be deleting 2 tables in my document plus a logo.
I got it to delete one table, but i cant seem to get it to delete both tables
and the logo. The code looks like this: ActiveDocument.Tables(1).Delete

what is the proper code to get the macro to delete all tables in the
document plus the logo?

any help is appreciated.

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Word should catalog misspelled words to study. rndthought Microsoft Word Help 39 May 21st 23 02:47 AM
How to put graphics on envelopes? Steve Koenig Microsoft Word Help 21 April 29th 23 02:47 AM
Change paper size; Word changes to invalid margins OhioTech New Users 10 July 6th 06 02:00 PM
How do I create Word macro that will run properly using copy/past. Joye Microsoft Word Help 1 June 23rd 06 10:41 PM
Table in a Form HiDbLevel Tables 12 February 27th 06 12:59 PM


All times are GMT +1. The time now is 10:34 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"