Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel+Not Enough Memory..

I've got a 2 sheet, 4mb workbook-sheet 2 containing the
raw product data, and sheet 1 acting as a template as
such, whereby a user enters a product code, and it looksup
the relevant info from sheet 2.

Problem..I have some VBA code incorporated into a control
box button which, i had hoped, would, on clicking, would
simply do effectively a paste special of sheet 1 into a
new workbook, temporarily save the workbook, email it off
to a pre-specified email address, and then delete the temp
workbook. Here is the code i used:-

Sub Mail_ActiveSheet()
Dim strDate As String

Application.ScreenUpdating = False
strDate = Format(Date, "dd-mm-yy") & " " & Format
(Time, "h-mm-ss")
FName$ = "Confirmation - " & strDate
ThisWorkbook.ActiveSheet.Copy
With ActiveWorkbook
With .ActiveSheet.UsedRange
.Copy
.PasteSpecial xlPasteValues
End With
.SaveAs Filename:="c:\" & FName$ & ".xls"
.SendMail ", "Confirmation
" & strDate
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Application.ScreenUpdating = True
End Sub

The problem is this-i have 48,000 rows of 4 colums of raw
data in sheet 2. But when i press my button, i get the
error message "Microsoft Excel Error-Not enough memory".

Now the lookups work fine and everything, and if i email
the whole workbook, it works fine, its just when i try to
email the first sheet i get this message, what am i doing
wrong??

Any help greatly appreciated
cheers
olly
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Excel+Not Enough Memory..

Hi Olly

Try this on the sheet

Sub Mail_ActiveSheet1()
Dim strDate As String
ActiveSheet.Copy
Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Application.CutCopyMode = False

strDate = Format(Date, "dd-mm-yy") & " " & Format(Time, "h-mm-ss")
ActiveWorkbook.SaveAs "Part of " & ThisWorkbook.Name _
& " " & strDate & ".xls"
ActiveWorkbook.SendMail ", _
"This is the Subject line"
ActiveWorkbook.ChangeFileAccess xlReadOnly
Kill ActiveWorkbook.FullName
ActiveWorkbook.Close False
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Olly" wrote in message ...
I've got a 2 sheet, 4mb workbook-sheet 2 containing the
raw product data, and sheet 1 acting as a template as
such, whereby a user enters a product code, and it looksup
the relevant info from sheet 2.

Problem..I have some VBA code incorporated into a control
box button which, i had hoped, would, on clicking, would
simply do effectively a paste special of sheet 1 into a
new workbook, temporarily save the workbook, email it off
to a pre-specified email address, and then delete the temp
workbook. Here is the code i used:-

Sub Mail_ActiveSheet()
Dim strDate As String

Application.ScreenUpdating = False
strDate = Format(Date, "dd-mm-yy") & " " & Format
(Time, "h-mm-ss")
FName$ = "Confirmation - " & strDate
ThisWorkbook.ActiveSheet.Copy
With ActiveWorkbook
With .ActiveSheet.UsedRange
.Copy
.PasteSpecial xlPasteValues
End With
.SaveAs Filename:="c:\" & FName$ & ".xls"
.SendMail ", "Confirmation
" & strDate
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Application.ScreenUpdating = True
End Sub

The problem is this-i have 48,000 rows of 4 colums of raw
data in sheet 2. But when i press my button, i get the
error message "Microsoft Excel Error-Not enough memory".

Now the lookups work fine and everything, and if i email
the whole workbook, it works fine, its just when i try to
email the first sheet i get this message, what am i doing
wrong??

Any help greatly appreciated
cheers
olly



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Excel+Not Enough Memory..


-----Original Message-----
Hi Olly

Try this on the sheet

Sub Mail_ActiveSheet1()
Dim strDate As String
ActiveSheet.Copy
Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Application.CutCopyMode = False

strDate = Format(Date, "dd-mm-yy") & " " & Format

(Time, "h-mm-ss")
ActiveWorkbook.SaveAs "Part of " & ThisWorkbook.Name _
& " " & strDate & ".xls"
ActiveWorkbook.SendMail ", _
"This is the Subject line"
ActiveWorkbook.ChangeFileAccess xlReadOnly
Kill ActiveWorkbook.FullName
ActiveWorkbook.Close False
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



Hi Ron
Cheers for that, but now getting this message
Run Time Error 1004
Select method of range class failed

any ideas ?
cheers
olly
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Excel+Not Enough Memory..


-----Original Message-----
Hi Olly

Try this on the sheet

Sub Mail_ActiveSheet1()
Dim strDate As String
ActiveSheet.Copy
Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Application.CutCopyMode = False

strDate = Format(Date, "dd-mm-yy") & " " & Format

(Time, "h-mm-ss")
ActiveWorkbook.SaveAs "Part of " & ThisWorkbook.Name _
& " " & strDate & ".xls"
ActiveWorkbook.SendMail ", _
"This is the Subject line"
ActiveWorkbook.ChangeFileAccess xlReadOnly
Kill ActiveWorkbook.FullName
ActiveWorkbook.Close False
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl




and now its back to out of memory error ..
hmmm
olly
Reply
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
not enough memory to print excel ws in 7 mrdave Excel Discussion (Misc queries) 1 January 16th 10 05:53 PM
XL 2007 - Out of Memory - memory leak/bug? PCLIVE Excel Discussion (Misc queries) 0 March 23rd 09 03:31 PM
Excel VB Out of Memory Annette Excel Discussion (Misc queries) 0 December 19th 07 07:29 PM
Memory Leak in Excel ofra Excel Discussion (Misc queries) 0 August 28th 05 02:20 PM
no enough memory to run excel viewer sean Excel Discussion (Misc queries) 0 March 18th 05 06:49 AM


All times are GMT +1. The time now is 08:12 AM.

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

About Us

"It's about Microsoft Excel"