Code not functional

D

Daniel

Hello,

The following is an extract from a much larger bit of code

ActiveDocument.Tables(t).Cell(intRows, 1).Select
Selection.MoveUp Unit:=wdLine, Count:=FRows, Extend:=wdExtend
Selection.Columns.PreferredWidthType = wdPreferredWidthPoints
Selection.Columns.PreferredWidth = InchesToPoints(5)

My issue is it always gens an error highlighting the

Selection.Columns.PreferredWidthType = wdPreferredWidthPoints

Line stating that it is unavailable. When I look at the doc it has selected
improperly cells within the doc.

The strange issue is that if I step through the code, it works perfectly!

I am using the following to create my table

ActiveDocument.Tables.Add Selection.Range, 1, 1, , wdAutoFitWindow

Is there a way to create a table and specify the column width at creation?

Any ideas or help are greatly appreciated,

Daniel P
 
D

Daniel

Never mind. I reworked my code differently and it works now.

I would still be interested if someone could explain why it does work when
run as a function but does if I step through the code line by line????
 

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