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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie needs help please

Status
Not open for further replies.

tecnik

Programmer
Feb 16, 2006
22
GB
Hi There,
I've been dabbling with macros in Word and trying to edit them using the editor however I've hit a little problem with one of them, here's the code:-

Sub rowHeight5mm()
Selection.Tables(1).Rows.HeightRule = wdRowHeightExactly
Selection.Tables(1).Rows.Height = CentimetersToPoints(0.5)
End Sub

When I run this macro it applies the setting to all cells within the table, is there any way i can limit it to just the cells I have selected?

Thanks in advance,

Nick
 
You will probably get more answers in:
Microsoft: Office Forum
forum68

However, in your code you are selecting the table. How about:
Code:
Sub rowHeight5mm()
    Selection.Rows.HeightRule = wdRowHeightExactly
    Selection.Rows.Height = CentimetersToPoints(0.5)
End Sub

 
Thanks for the help, that worked perfectly.

I wasn't sure which forum to go for however next time I'll try the Microsoft Office forum.

Thanks again,

Nick
 
You are welcome, and welcome to Tek-Tips, too :)
 
Looking at my code again I should have seen the solution earlier, it's there in black and white! Doh!

I've managed to come up with some more variations on a theme that will be time savers on a job I'm working on.

I think the next one's going to be a little more tricky - drawing a line between two selected rectangles, probably easy for a seasoned pro, but for a newbie!

Nick
 
we were/are all newbies at some point, the most important thing is the willingness to learn, which you seem to have, so go for it, we don't bite here on Tek-Tips ;-)

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Thanks for the reply, I'm sure I've heard that quote on a Janet Jackson track, but ssshhhhhh, keep that one quiet :)

Any ideas on the easiest way to draw a line on the right hand side of a selected rectangle. The line would be touching the side of the rectangle and half way down it.

Thanks
 
I'm afraid I don't know the answer on this one, i don't do much work with VBA for Excel & Word, apart from the export/import of excel records and mailmerging with word docs.

It might be worth trying the MS Office forum, good luck :)

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top