Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2007

Tip: Looking for answers? Try searching our database.

Error sub or function not defined macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bob - 19 Oct 2007 11:30 GMT
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
Jean-Guy Marcil - 19 Oct 2007 17:11 GMT
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?
[quoted text clipped - 10 lines]
>     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?

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

Bob - 20 Oct 2007 10:27 GMT
Thanks Jean-Guy,,
> Bob was telling us:
> Bob nous racontait que :
[quoted text clipped - 19 lines]
> Do you have another sub named oTbl or a another function called
> ResizeAllTables elsewhere in your project?
Jean-Guy Marcil - 22 Oct 2007 16:01 GMT
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!

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org


Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.