Error sub or function not defined macro

B

Bob

I received error sub or function not defined in Word 2003 - any ideas what I should alter please?

'does not work
Sub ResizeAllTables()
Dim oTbl As Table
For Each oTbl In ActiveDocument.Tables
oTbl.AutoFitBehavior wdAutoFitFixed
With ActiveDocument.PageSetup
oTbl.PreferredWidth = .PageWidth - .LeftMargin - ..RightMargin
End With
Next oTbl
End Sub
 
J

Jean-Guy Marcil

Bob was telling us:
Bob nous racontait que :
I received error sub or function not defined in Word 2003 - any ideas
what I should alter please?

'does not work
Sub ResizeAllTables()
Dim oTbl As Table
For Each oTbl In ActiveDocument.Tables
oTbl.AutoFitBehavior wdAutoFitFixed
With ActiveDocument.PageSetup
oTbl.PreferredWidth = .PageWidth - .LeftMargin -
.RightMargin
End With
Next oTbl
End Sub

I tested your code as is (except that I removed the "oTbl" in "Next oTbl" as
it is not necessary) and it worked fine. I am also using Word 2003.

Do you have another sub named oTbl or a another function called
ResizeAllTables elsewhere in your project?

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
B

Bob

Thanks Jean-Guy,,
Jean-Guy Marcil said:
Bob was telling us:
Bob nous racontait que :


I tested your code as is (except that I removed the "oTbl" in "Next oTbl"
as it is not necessary) and it worked fine. I am also using Word 2003.

Do you have another sub named oTbl or a another function called
ResizeAllTables elsewhere in your project?

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
J

Jean-Guy Marcil

Bob was telling us:
Bob nous racontait que :
Thanks Jean-Guy,,

You're welcome... but I have no clue what you are thanking me for!

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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