Object is empty (I'm new to macros!)

J

Josh Craig

I get run-time error 4605 'this method or property is not available because
the object is empty' in between these two lines of code:

Selection.Fields.Unlink
(error occurs here)

Selection.ConvertToTable Separator:=wdSeparateByParagraphs,
NumColumns:=1, _
NumRows:=17, AutoFitBehavior:=wdAutoFitFixed

How do I make the selection for 'convert to table' the same as the selection
whose fields I just unlinked?
 
R

Rob

I have no idea what's going on before this point, or what you're trying to
accomplish, but I get no error with your code if I select the field first by
selecting its bookmark (name):

ActiveDocument.Bookmarks("Text1").Select

Replace "Text1" with the actual name. Put this above your code.
 
S

Stefan Blom

Assuming that the selection isn't empty, the code should work. Is there
any code between the lines you posted (that could possibly affect the
selection)?

--
Stefan Blom
Microsoft Word MVP


in message
news:D[email protected]...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top