A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Tables
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Converting Tables to Text macro



 
 
Thread Tools Display Modes
  #1  
Old January 6th, 2010, 04:26 PM posted to microsoft.public.word.tables
mnt
external usenet poster
 
Posts: 3
Default Converting Tables to Text macro

I have a macro I'm starting to have trouble with. I copy a one-column MS
Access query result. Then in Word, it pastes it in to a doc as RTF, goes to
the end of the doc, moves up one row and converts the table to text.

The macro is erroring out because the "object doesn't refer to a table." If
I go into the doc and see where the cursor is, it's at the bottom of the doc
and I cannot move it (via arrow keys) up one line to get the cursor into the
table - thus the error, I think.

Is there something I can do differently in the macro so I'm always located
in the table and the macro can run?
  #2  
Old January 6th, 2010, 09:32 PM posted to microsoft.public.word.tables
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,239
Default Converting Tables to Text macro

If it is the only table in the document, use

ActiveDocument.Tables(1).ConvertToText

or if there is more than one and this is the last table, use:

With ActiveDocument
.Tables(.Tables.Count).ConvertToText
End With


--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my services on
a paid professional basis.

"mnt" wrote in message
...
I have a macro I'm starting to have trouble with. I copy a one-column MS
Access query result. Then in Word, it pastes it in to a doc as RTF, goes
to
the end of the doc, moves up one row and converts the table to text.

The macro is erroring out because the "object doesn't refer to a table."
If
I go into the doc and see where the cursor is, it's at the bottom of the
doc
and I cannot move it (via arrow keys) up one line to get the cursor into
the
table - thus the error, I think.

Is there something I can do differently in the macro so I'm always located
in the table and the macro can run?


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:54 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.