Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-08-2016, 04:41 AM
macropod's Avatar
macropod macropod is offline Insufficient memory error when printing to a macro Windows 7 64bit Insufficient memory error when printing to a macro Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,375
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

Although the code could be improved, there is nothing obvious about it that would cause the errors you're experiencing. Given that the error message relates to fonts, perhaps you have a corrupt one in use by the document(s) throwing the error. Fixing that would entail identifying the font(s) used in that document that are not used elsewhere and reinstalling them.



As an example of the possible improvements, you could make the code more efficient by replacing:
Code:
Dim oSct As Section
Dim iSection As Integer
'
iSection = 1
'
For Each oSct In ActiveDocument.Sections
  With ActiveDocument.Sections(iSection).PageSetup
    .FirstPageTray = wdPrinterUpperBin
    .OtherPagesTray = wdPrinterMiddleBin
  End With
 
  iSection = iSection + 1
  '
Next oSct
with:
Code:
Dim oSct As Section
'
For Each oSct In ActiveDocument.Sections
  With oSct.PageSetup
    .FirstPageTray = wdPrinterUpperBin
    .OtherPagesTray = wdPrinterMiddleBin
  End With
Next oSct
If some of the documents have many Sections, you might use something like:
Code:
Dim iSection As Long
With ActiveDocument
  For iSection = 1 To .Sections.Count
    With .Sections(iSection).PageSetup
      .FirstPageTray = wdPrinterUpperBin
      .OtherPagesTray = wdPrinterMiddleBin
    End With
    If iSection Mod 20 = 0 Then DoEvents
  Next iSection
End With
Applying DoEvents periodically gives Word scope for its own housekeeping.

PS: When posting code, please use the code tags, indicated by the # button on the posting menu. Without them, your ~400 lines of code lost much of whatever structure it had.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
ms word, print macro, win10



Similar Threads
Thread Thread Starter Forum Replies Last Post
Embeding Excel Docs in Word - Receiving Memory Error Message if Excel is open kdash Word 0 05-06-2015 09:38 AM
Insufficient memory error when printing to a macro Insufficient resources error detobias Excel 1 06-03-2014 09:25 AM
Error in printing callkalpa Word 0 09-21-2010 07:35 PM
TOC printing Error Bookmark not Defined techexpressinc Word 0 12-14-2008 05:24 PM
Error message when printing e-mails nolson Outlook 0 01-02-2006 09:50 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:05 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft