View Single Post
 
Old 02-24-2014, 06:17 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The code you've posted initializes the userform with contents drawn only from the second table in the document. So, if your command button is doing something different, it seems to me your command button code is where you should look.

A couple of points:
1. Having set oTbl via 'Set oTbl = oDoc.Tables(2)', the first set of loops ignores that and continues to reference oDoc.Tables(2);
2. Whereas the first loop efficiently uses a range object to retrieve the cell content, the second loop takes an entirely different, and less efficient, approach, retrieving then truncating the cell content. You could quite easily have re-used the previous range object (and even the row/column indices rather than using a completely new set).
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote