Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Collection manipulation VBA

Status
Not open for further replies.

DataHugger

Programmer
May 26, 2004
38
US
WordObj(1).Paragraphs(FinDoc.Paragraphs.Count).Range.Select.AutoFitBehavior (wdAutoFitContent)

This is my line of code. I select the first word document in my open application and then I seledt the nth paragraph object.
I think attempt to select the range with should also be a table and then call the auto fit behavior on it.

I, however, am not accessing the objects right or something like that. This is not the only incarnation of the line. I have tried to access the object every way except the right way. I have not fully graspe vba syntax yet. So to me this lne looks right. I have been pounding my head against this all day. Can someone please tell me what I am doin wrong?

-Datahugger
 
Have you tried this ?
WordObj(1).Paragraphs(FinDoc.Paragraphs.Count).Range.[highlight]Tables(1)[/highlight].AutoFitBehavior wdAutoFitContent

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hi DataHugger,

WordObj is an unusual name for the Documents Collection, so what is it?

Do you perhaps want WordObj.Documents(1)?

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top