Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insufficient Memory

Status
Not open for further replies.

gloudo

Programmer
Feb 3, 2002
34
0
0
NL
Hi there,

I Have A script to sent a workbook with Outlook from Excel.
But When I try the script, I get the Message "Insufficient Memory" What's Wrong With The Script? Or Maybe there is a more easy way to sent the Workbook?

Sub Verzenden()
Dim objOL As Outlook.Application
Dim objMail As MailItem
Dim MailAd As String
Dim Msg As String
Dim Subj As String
Dim URLto As String
Dim Attach As Attachment

Set objOL = Outlook.Application
Set Mail = objOL.CreateItem(olMailItem)

With objMail
MailAd = "RCA (LT)" + ";" + "Ontvangst FD"
Subj = "Test"
Msg = Msg & "Dit is een Test"
Attach = "C:\data\thijs\test.txt"

URLto = "mailto:" & MailAd & "?subject=" & Subj & "&body=" & Msg & "Attachment=" & Attach
ActiveWorkbook.FollowHyperlink Address:=URLto
End With

Set objMail = Nothing
Set objOL = Nothing

End Sub
 
Hi
In my humble experince the "Insufficient memory" error is a mem-laps at microsoft read: "We dont know why!" , but there is some kind of error, and no help available.

Try cutting your code into smaller pcs and get it work, then add more code pce by pce.
 
I experienced similar problem when exporting Data from Access to Excel. The following article at Microsoft web site may help:


Or simply go to microsoft.com and search the following:
PRB: Cross-Process COM Automation Can Hang Client Application on Win95/98 (Q216400)

The point is, when doing automation or any kind of Cross Application programming, you need to use as little number of interface calls as possible. The Article above has an example of what I was talking about.

In addition, read the following paragraph taken from

Windows 95/98 limitation on interface requests
There is another attraction to minimizing your interface requests. When automating any ActiveX® component, there is a limit to the number of interface requests you can make within a tight loop on Windows® 95 and Windows 98. This limit is roughly 64 kilobytes (KB). If you write code that comes close to or exceeds this limit, you might experience any of the following:

Your Automation server hangs.
You receive "Out of memory" errors.
Your Automation server remains in memory even after your application ends.
To avoid this limit, use these techniques whenever possible:

Use arrays and call methods and properties on multiple objects at once rather than on individual objects.
Set variables for Automation objects that you frequently reference or reference in a loop.
Use the features of the Automation server to your advantage.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top