The app is meant to calculate markups and taxes for resale.
I've ironed all the kinks out and the app works perfectly except for an odd memory issue.
I added an option to automatically grab and calculate data from the windows clipboard (so I can Ctrl+C stuff from other programs) and managed to get it to filter out everything but text data copied in there.
It limits the length of text it will input into the calculator but for some reason it causes the memory usage to climb until crash while a large block of text resides in the clipboard and Check2 is enabled (I attached the little app here if you want to see the behavior. Just copy a large document, check Auto-Fill and watch the memory usage climbing).
Here's the code that seems to be the culprit:
- Code: Select all
Private Sub Timer1_Timer()
'auto-fill from clipboard'
If Check2.Value = 1 Then
Dim DataObj As New MSForms.DataObject
DataObj.GetFromClipboard
'It's text right? It's not too long is it?"
If (Clipboard.GetFormat(vbCFText) = True) And ((Len(DataObj.GetText()) < 10)) Then
'okay, it's good, fill Text1 with the data'
Text1.Text = DataObj.GetText
Else
'memory use climbs continually with large areas of text in clipboard. Solution?'
DataObj.Clear
Set DataObj = Nothing
End If
End If
'kill it again!!'
DataObj.Clear
Set DataObj = Nothing
End Sub
Anybody know what I'm doing wrong? I can be careful running the app so it still works okay but I'd like to learn to do it correctly.
Thanks for any help you could give me!
-John


