LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Running out of memory when adding logos to reports

I am running Excel 2000 on XP. I have scripts that pull data from a
database and turn them into a number of reports. Each report is
supposed to have our logo and the client's logo. I have the logos on
a sheet in the excel book.

After each sheet is formatted I call a routine to put the logos on.
(see code below)

A single run of formatting creates something in the neighborhood of
160 sheets in 47 books. If I remove adding the logos everything works
fine. Infact I reran the formating so many times that I was opening
"Book 423" withought error. If the adding logos in included the
process gets through about 35 sheets and then I get an error on a line
that says "cannot set the PrintTitleColumns field" and points to the
line :"ActiveSheet.PageSetup.PrintTitleColumns = """ Obviousely this
line is NOT the problem.

Here is how I am adding the logos. Is there a better way? Am I
missing something in here?

Sub addLogo(lastcol As Integer)

Dim left As Integer
Dim top As Integer
Dim height As Integer
Dim width As Integer
Dim hscale As Double
Dim vscale As Double
Dim fscale As Double

Sheets("Logos").Shapes("MyLogo").Copy
With Range(Cells(1, lastcol - 2), Cells(4, lastcol))
left = .left
top = .top
height = .height
width = .width
End With

Range(Cells(1, lastcol - 2), Cells(4, lastcol)).PasteSpecial
Selection.Name = "MyLogo"
vscale = width / ActiveSheet.Shapes.Range("MyLogo").width
hscale = height / ActiveSheet.Shapes.Range("MyLogo").height

fscale = 1
If (hscale <= vscale And hscale < 1) Then
fscale = hscale
ElseIf (vscale < hscale And vscale < 1) Then
fscale = vscale
End If

ActiveSheet.Shapes.Range("MyLogo").ScaleWidth fscale, msoFalse,
msoScaleFromBottomRight
ActiveSheet.Shapes.Range("MyLogo").ScaleHeight fscale, msoFalse,
msoScaleFromTopLeft
ActiveSheet.Shapes.Range("MyLogo").left = (left + width) -
ActiveSheet.Shapes.Range("MyLogo").width - 5
ActiveSheet.Shapes.Range("MyLogo").top = top

Sheets("Logos").Shapes("ClientLogo").Copy
With Range(Cells(1, 1), Cells(4, 3))
left = .left
top = .top
height = .height
width = .width
End With
Range(Cells(1, 1), Cells(4, 3)).PasteSpecial
Selection.Name = "ClientLogo"
vscale = width / ActiveSheet.Shapes.Range("ClientLogo").width
hscale = height / ActiveSheet.Shapes.Range("ClientLogo").height

fscale = 1
If (hscale <= vscale And hscale < 1) Then
fscale = hscale
ElseIf (vscale < hscale And vscale < 1) Then
fscale = vscale
End If

ActiveSheet.Shapes.Range("ClientLogo").ScaleWidth fscale, msoFalse,
msoScaleFromBottomRight
ActiveSheet.Shapes.Range("ClientLogo").ScaleHeight fscale, msoFalse,
msoScaleFromTopLeft
ActiveSheet.Shapes.Range("ClientLogo").left = left + 5
ActiveSheet.Shapes.Range("ClientLogo").top = top

End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy/Paste - Running out of Memory Cheval New Users to Excel 1 October 12th 06 01:40 PM
Running updates reports automatically alex Excel Programming 1 August 5th 05 01:34 PM
Running out of memory Ian Belcher[_2_] Excel Programming 4 June 4th 04 09:55 AM
XP running out of memory when using macro JamieD Excel Programming 3 October 22nd 03 03:42 PM
Not enough Memory running macro Rich96 Excel Programming 2 September 19th 03 11:58 PM


All times are GMT +1. The time now is 12:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"