PDA

View Full Version : Solved: Autofit row height with VBA



rob0923
09-24-2009, 09:32 AM
Hi,

Is it possible to auto fit the row height in a word table to the size of the text using a VBA?

Thanks,

fumei
09-24-2009, 12:57 PM
Have you tried recording a macro? Why do you need VBA? Just autofit the table. Or I am missing something. Could you explain what you need?

rob0923
09-25-2009, 05:59 AM
Hi,

I am running an auto merge from excel to word and the word file is protected, so I was hoping to have it automated. The autofit feature in word table seem to only auto fit to the page window. I can't find an option to auto fit the row height.

geekgirlau
09-29-2009, 05:57 PM
ActiveDocument.Tables(1).Rows.HeightRule = wdRowHeightAuto

macropod
09-29-2009, 07:01 PM
Hi rob0923,

I am running an auto merge from excel to word and the word file is protectedIf you're running a (mail) merge, (forms) protection may prevent the merge from occurring. So why is the document protected, and why do you need vba?

rob0923
10-01-2009, 05:27 PM
Hi,

Its protected to make sure no one deletes any bookmarks and its being transfered from excel to word run by a macro for automation.

The code is working great!

Thanks again!