Out of Memory - Why?

DwinZly

Board Regular
Joined
Oct 26, 2009
Messages
56
I have created a macro that logs the changes of each cell in the comments of that cell but for some reason, I keep getting an "Out of Memory" error. This is being called from a userform. Can someone please tell me why I keep getting this error? Code below:

Code:
Sub LogChanges(RowImIn As String)
Dim varComment As String
Dim c As Comment


With ActiveSheet.Cells(RowImIn, 11)
    On Error Resume Next
    Set c = .Comment
    On Error GoTo 0
    If c Is Nothing Then
        ActiveSheet.Cells(RowImIn, 11).AddComment "Updated on " & Format(Now(), "mm/dd/yy hh:mm") & " by " & Inits & " from " & ActiveSheet.Cells(RowImIn, 11).Value
    Else
        varComment = c.Text
        ActiveSheet.Cells(RowImIn, 11).ClearComments
        ActiveSheet.Cells(RowImIn, 11).AddComment varComment & vbNewLine & "Updated on " & Format(Now(), "mm/dd/yy hh:mm") & " by " & Inits & " from " & ActiveSheet.Cells(RowImIn, 11).Value
    End If
End With


End Sub

Code:
Function Inits() As String

Dim objword As Object
Set objword = CreateObject("Word.Application")
Inits = objword.UserInitials
objword.Quit
End Function

Thanks
 
Last edited:

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
This seems to work fine.

I am not sure I would open a word doc each time, I personally in the sub would dim Inits as string
Inits = application.username

I assume RowImIn is being got from somewhere else. That's the only bit I haven't tested as I its not in this subroutine
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,885
Messages
6,181,574
Members
453,055
Latest member
cope7895

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top