Results 1 to 22 of 22

Thread: [RESOLVED] Memory Problem in VBA

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2006
    Posts
    35

    Resolved [RESOLVED] Memory Problem in VBA

    Hello Experts,

    I need your help here :

    I am creating a VBA Application where in I have to pick data from Excel and then I have to transfer the data in a Powerpoint's Chart Object. My excel file has six different groups. Each group has nine slides and each slide has three Graphs. Each Graph has further three values. Whenever I run my function, it enters the values till fourth group but as it comes to the fifth group, its memory gets full and my computer hangs. Is there any way that I can free up my memory?????? Or I can increase my memory within my application if needed???? Any help would be appreciated...

    Thanks,Vikas Bhandari

  2. #2
    Fanatic Member Dnereb's Avatar
    Join Date
    Aug 2005
    Location
    Netherlands
    Posts
    863

    Re: Memory Problem in VBA

    To help you it's neccesary to read the code in your problematic function to spot the cause of the problem.
    why can't programmers keep and 31 Oct and 25 dec apart. Why Rating is Useful
    for every question you ask provide an answer on another thread.

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2006
    Posts
    35

    Re: Memory Problem in VBA

    Thanks for the Reply! Here is the code.

    VB Code:
    1. Dim oshape As PowerPoint.Shape          ' Stores Powerpoint objects
    2. Dim ofile As PowerPoint.Presentation    'Powerpoint Presentation object
    3. Dim pptApp As PowerPoint.Application    'Powerpoint application object
    4. Dim oGraph As Graph.Chart
    5. Dim rnge As Long
    6. Dim fir(27) As Integer
    7. Dim i As Integer
    8. Dim objs(6, 27) As Integer
    9. Dim slds(6, 9) As Integer
    10. Dim cols(6, 3) As String 'we need to make \it two dimensiol for future reference
    11. Dim j As Integer
    12. Dim k As Integer
    13. Dim xlwrk As Excel.Workbook
    14. Dim ppt As Object
    15. Dim ppt1 As String
    16. Dim mon(12) As String
    17. Dim newRan As Range
    18. mon(1) = "A"
    19. mon(2) = "B"
    20. mon(3) = "C"
    21. mon(4) = "D"
    22. mon(5) = "E"
    23. mon(6) = "F"
    24. mon(7) = "G"
    25. mon(8) = "H"
    26. mon(9) = "I"
    27. mon(10) = "J"
    28. mon(11) = "K"
    29. mon(12) = "L"
    30.  
    31.  
    32.  
    33. slds(1, 1) = 16
    34. slds(1, 2) = 17
    35. slds(1, 3) = 18
    36. slds(1, 4) = 21
    37. slds(1, 5) = 22
    38. slds(1, 6) = 23
    39. slds(1, 7) = 24
    40. slds(1, 8) = 25
    41. slds(1, 9) = 26
    42.  
    43.  
    44. slds(2, 1) = 27
    45. slds(2, 2) = 28
    46. slds(2, 3) = 29
    47. slds(2, 4) = 32
    48. slds(2, 5) = 33
    49. slds(2, 6) = 34
    50. slds(2, 7) = 35
    51. slds(2, 8) = 36
    52. slds(2, 9) = 37
    53.  
    54.  
    55. slds(3, 1) = 38
    56. slds(3, 2) = 39
    57. slds(3, 3) = 40
    58. slds(3, 4) = 43
    59. slds(3, 5) = 44
    60. slds(3, 6) = 45
    61. slds(3, 7) = 46
    62. slds(3, 8) = 47
    63. slds(3, 9) = 48
    64.  
    65.  
    66. slds(4, 1) = 49
    67. slds(4, 2) = 50
    68. slds(4, 3) = 51
    69. slds(4, 4) = 54
    70. slds(4, 5) = 55
    71. slds(4, 6) = 56
    72. slds(4, 7) = 57
    73. slds(4, 8) = 58
    74. slds(4, 9) = 59
    75.  
    76.  
    77. slds(5, 1) = 60
    78. slds(5, 2) = 61
    79. slds(5, 3) = 62
    80. slds(5, 4) = 65
    81. slds(5, 5) = 66
    82. slds(5, 6) = 67
    83. slds(5, 7) = 68
    84. slds(5, 8) = 69
    85. slds(5, 9) = 70
    86.  
    87.  
    88. slds(6, 1) = 71
    89. slds(6, 2) = 72
    90. slds(6, 3) = 73
    91. slds(6, 4) = 76
    92. slds(6, 5) = 77
    93. slds(6, 6) = 78
    94. slds(6, 7) = 79
    95. slds(6, 8) = 80
    96. slds(6, 9) = 81
    97.    
    98.  
    99.  
    100.  
    101. objs(1, 1) = 12
    102. objs(1, 2) = 13
    103. objs(1, 3) = 10
    104. objs(1, 4) = 11
    105. objs(1, 5) = 3
    106. objs(1, 6) = 7
    107. objs(1, 7) = 7
    108. objs(1, 8) = 11
    109. objs(1, 9) = 3
    110. objs(1, 10) = 6
    111. objs(1, 11) = 10
    112. objs(1, 12) = 0
    113. objs(1, 13) = 14
    114. objs(1, 14) = 8
    115. objs(1, 15) = 12
    116. objs(1, 16) = 13
    117. objs(1, 17) = 7
    118. objs(1, 18) = 12
    119. objs(1, 19) = 16
    120. objs(1, 20) = 7
    121. objs(1, 21) = 3
    122. objs(1, 22) = 6
    123. objs(1, 23) = 8
    124. objs(1, 24) = 16
    125. objs(1, 25) = 14
    126. objs(1, 26) = 10
    127. objs(1, 27) = 0
    128.  
    129.  
    130.  
    131. objs(2, 1) = 19
    132. objs(2, 2) = 3
    133. objs(2, 3) = 11
    134. objs(2, 4) = 11
    135. objs(2, 5) = 3
    136. objs(2, 6) = 7
    137. objs(2, 7) = 7
    138. objs(2, 8) = 12
    139. objs(2, 9) = 3
    140. objs(2, 10) = 10
    141. objs(2, 11) = 6
    142. objs(2, 12) = 0
    143. objs(2, 13) = 3
    144. objs(2, 14) = 9
    145. objs(2, 15) = 13
    146. objs(2, 16) = 4
    147. objs(2, 17) = 5
    148. objs(2, 18) = 13
    149. objs(2, 19) = 4
    150. objs(2, 20) = 7
    151. objs(2, 21) = 14
    152. objs(2, 22) = 3
    153. objs(2, 23) = 7
    154. objs(2, 24) = 13
    155. objs(2, 25) = 13
    156. objs(2, 26) = 9
    157. objs(2, 27) = 0
    158.  
    159.  
    160.  
    161. objs(3, 1) = 19
    162. objs(3, 2) = 3
    163. objs(3, 3) = 11
    164. objs(3, 4) = 11
    165. objs(3, 5) = 3
    166. objs(3, 6) = 7
    167. objs(3, 7) = 7
    168. objs(3, 8) = 12
    169. objs(3, 9) = 3
    170. objs(3, 10) = 10
    171. objs(3, 11) = 6
    172. objs(3, 12) = 0
    173. objs(3, 13) = 3
    174. objs(3, 14) = 9
    175. objs(3, 15) = 13
    176. objs(3, 16) = 4
    177. objs(3, 17) = 5
    178. objs(3, 18) = 13
    179. objs(3, 19) = 4
    180. objs(3, 20) = 7
    181. objs(3, 21) = 14
    182. objs(3, 22) = 3
    183. objs(3, 23) = 7
    184. objs(3, 24) = 13
    185. objs(3, 25) = 14
    186. objs(3, 26) = 10
    187. objs(3, 27) = 0
    188.  
    189.  
    190.  
    191. objs(4, 1) = 19
    192. objs(4, 2) = 3
    193. objs(4, 3) = 11
    194. objs(4, 4) = 14
    195. objs(4, 5) = 4
    196. objs(4, 6) = 9
    197. objs(4, 7) = 7
    198. objs(4, 8) = 12
    199. objs(4, 9) = 3
    200. objs(4, 10) = 10
    201. objs(4, 11) = 6
    202. objs(4, 12) = 0
    203. objs(4, 13) = 3
    204. objs(4, 14) = 9
    205. objs(4, 15) = 13
    206. objs(4, 16) = 4
    207. objs(4, 17) = 5
    208. objs(4, 18) = 13
    209. objs(4, 19) = 4
    210. objs(4, 20) = 7
    211. objs(4, 21) = 14
    212. objs(4, 22) = 3
    213. objs(4, 23) = 7
    214. objs(4, 24) = 13
    215. objs(4, 25) = 14
    216. objs(4, 26) = 10
    217. objs(4, 27) = 0
    218.  
    219.  
    220.  
    221. objs(5, 1) = 18
    222. objs(5, 2) = 19
    223. objs(5, 3) = 10
    224. objs(5, 4) = 14
    225. objs(5, 5) = 4
    226. objs(5, 6) = 9
    227. objs(5, 7) = 7
    228. objs(5, 8) = 12
    229. objs(5, 9) = 3
    230. objs(5, 10) = 10
    231. objs(5, 11) = 6
    232. objs(5, 12) = 0
    233. objs(5, 13) = 3
    234. objs(5, 14) = 9
    235. objs(5, 15) = 13
    236. objs(5, 16) = 4
    237. objs(5, 17) = 5
    238. objs(5, 18) = 13
    239. objs(5, 19) = 4
    240. objs(5, 20) = 7
    241. objs(5, 21) = 14
    242. objs(5, 22) = 3
    243. objs(5, 23) = 7
    244. objs(5, 24) = 13
    245. objs(5, 25) = 14
    246. objs(5, 26) = 10
    247. objs(5, 27) = 0
    248.  
    249.  
    250.  
    251.  
    252. objs(6, 1) = 18
    253. objs(6, 2) = 19
    254. objs(6, 3) = 10
    255. objs(6, 4) = 14
    256. objs(6, 5) = 4
    257. objs(6, 6) = 9
    258. objs(6, 7) = 7
    259. objs(6, 8) = 12
    260. objs(6, 9) = 3
    261. objs(6, 10) = 10
    262. objs(6, 11) = 6
    263. objs(6, 12) = 0
    264. objs(6, 13) = 3
    265. objs(6, 14) = 9
    266. objs(6, 15) = 13
    267. objs(6, 16) = 4
    268. objs(6, 17) = 5
    269. objs(6, 18) = 13
    270. objs(6, 19) = 4
    271. objs(6, 20) = 7
    272. objs(6, 21) = 14
    273. objs(6, 22) = 3
    274. objs(6, 23) = 7
    275. objs(6, 24) = 13
    276. objs(6, 25) = 14
    277. objs(6, 26) = 10
    278. objs(6, 27) = 0
    279.  
    280. cols(1, 1) = "B"
    281. cols(1, 2) = "D"
    282. cols(1, 3) = "F"
    283.  
    284. cols(2, 1) = "I"
    285. cols(2, 2) = "K"
    286. cols(2, 3) = "M"
    287.  
    288. cols(3, 1) = "P"
    289. cols(3, 2) = "R"
    290. cols(3, 3) = "T"
    291.  
    292. cols(4, 1) = "W"
    293. cols(4, 2) = "Y"
    294. cols(4, 3) = "AA"
    295.  
    296. cols(5, 1) = "AD"
    297. cols(5, 2) = "AF"
    298. cols(5, 3) = "AH"
    299.  
    300. cols(6, 1) = "AK"
    301. cols(6, 2) = "AM"
    302. cols(6, 3) = "AO"
    303.  
    304. fir(1) = 2
    305. fir(2) = 2
    306. fir(3) = 3
    307. fir(4) = 1
    308. fir(5) = 1
    309. fir(6) = 1
    310. fir(7) = 1
    311. fir(8) = 3
    312. fir(9) = 1
    313. fir(10) = 4
    314. fir(11) = 4
    315. fir(12) = 0
    316. fir(13) = 1
    317. fir(14) = 1
    318. fir(15) = 1
    319. fir(16) = 1
    320. fir(17) = 1
    321. fir(18) = 1
    322. fir(19) = 3
    323. fir(20) = 3
    324. fir(21) = 3
    325. fir(22) = 1
    326. fir(23) = 1
    327. fir(24) = 1
    328. fir(25) = 2
    329. fir(26) = 2
    330. fir(27) = 0
    331.  
    332. Dim rowArr(9) As Integer
    333. rowArr(1) = 3
    334. rowArr(2) = 8
    335. rowArr(3) = 12
    336. rowArr(4) = 17
    337. rowArr(5) = 24
    338. rowArr(6) = 27
    339. rowArr(7) = 30
    340. rowArr(8) = 34
    341. rowArr(9) = 37
    342.  
    343. Dim objCoun As Integer ' this is a counter for increasing Object's Value
    344. Dim coun As Integer
    345. Dim mo As Integer
    346. objCoun = 1
    347. mo = InputBox("Enter The Month for which you want to update the presentation")
    348. If mo = Sheet3.Range("A1").Value Then
    349. Set xlwrk = ActiveWorkbook
    350. Set pptApp = CreateObject("PowerPoint.Application")
    351. pptApp.Visible = msoTrue
    352. Set ofile = pptApp.Presentations.Open(ThisWorkbook.Path & "\2006 Citigroup KPI1.ppt")
    353. Dim grp As Integer
    354. Sheets("Sheet2").Select
    355.         For grp = 1 To 1
    356.         'MsgBox ("Startng " & grp)
    357.         objCoun = 1
    358.         coun = 1
    359.  
    360.     For i = 1 To 9
    361. Dim bool As Boolean
    362.         For j = 1 To 3
    363.         coun = rowArr(i)
    364.        
    365.                If fir(objCoun) > 0 Then
    366.                
    367.                 bool = True
    368.                 k = 1
    369.                 For k = 1 To fir(objCoun)
    370.                 ofile.Slides(slds(grp, i)).Select
    371.                 Set oshape = ofile.Slides(slds(grp, i)).Shapes("object " & objs(grp, objCoun))
    372.                 Set oGraph = oshape.OLEFormat.Object
    373.                 Sheet2.Range(cols(grp, j) & coun).Select
    374.                 rnge = ActiveCell.Value
    375.                     If (i = 7 And bool) Or (i = 3 And bool) Then
    376.                     bool = False
    377.                     k = k + 1
    378.                     End If
    379.                     If i <> 7 And i <> 3 And fir(objCoun) = 1 Then
    380.                     k = k + 1
    381.                     End If
    382.                     coun = coun + 1
    383.                
    384.                 oGraph.Application.DataSheet.Range(mon(mo) & k).Value = rnge 'xlwrk.Worksheets("Sheet2").Range(cols(grp, j) & coun) 'rnge
    385.                'oGraph.Application.DataSheet.Cells(mo, k).Value = rnge
    386.                oGraph.Application.Update
    387.                pptApp.ActiveWindow.Selection.Unselect
    388.  
    389.                Set oshape = Nothing
    390.                Set oGraph = Nothing
    391.                 Next
    392.             End If
    393.         objCoun = objCoun + 1
    394.         Next
    395.            
    396.     Next
    397.    Next
    398. MsgBox ("done")
    399. Else
    400.            MsgBox "Please import the data for correct month"
    401. End If
    402. End Sub
    Last edited by vikasbhandari2; Jun 19th, 2006 at 06:15 AM.

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Memory Problem in VBA

    Excel VBA question moved to Office Development

  5. #5

    Thread Starter
    Member
    Join Date
    Jun 2006
    Posts
    35

    Re: Memory Problem in VBA

    Can some one plz plz look into this once...i am all blocked for the time...

    Thanks,Vikas

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Memory Problem in VBA

    What about adding a DoEvents in your inner loop?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    Member
    Join Date
    Jun 2006
    Posts
    35

    Re: Memory Problem in VBA

    dont know much bout it...trying it though....any other thoughts????

  8. #8

    Thread Starter
    Member
    Join Date
    Jun 2006
    Posts
    35

    Re: Memory Problem in VBA

    Hey Rob,

    i dont know much about it...can you please explain it a little bit about how to use Do Events??? I never used it (

    Thanks in advance....you are helping a lot )

  9. #9
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Memory Problem in VBA

    VB Code:
    1. For k = 1 To fir(objCoun)
    2. DoEvents
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  10. #10
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Memory Problem in VBA

    Well your doing allot of selecting and other operations so not much to reduce there.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  11. #11

    Thread Starter
    Member
    Join Date
    Jun 2006
    Posts
    35

    Re: Memory Problem in VBA

    Hello Rob,

    I tried to find information about DoEvent. I found that DoEvents is for holding our code for some time and letting other events run....Am I right???

    In my program, I dont want to stop, rather I want to create the code in such a way so that Memory doesnt get consume at such a higher rate and even if its consuming?? How can I free that memory??

    Thanks,
    Vikas Bhandari

  12. #12
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Memory Problem in VBA

    are u sure its hanging from memory?

    does it error and say "Out of memory"

    run the task manager and check your memory...
    unless your Harddrive is almost full or u have your swapfile set small.. I doubt thats the reason.
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  13. #13
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Memory Problem in VBA

    What DoEvents does is allow some of the CPU resources to be availible for other tasks and screen updating/painting etc. So it makes your app more fluid in motion and less locked from the cpu being pegged and such. It doesnt stop the processing of your code at all.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  14. #14

    Thread Starter
    Member
    Join Date
    Jun 2006
    Posts
    35

    Re: Memory Problem in VBA

    Hey Rob/Static,

    I will specify the prob in detail here :

    When I run my Macro for six groups, it works fine for almost 3-1/2 group items, but as soon as I reach to the end of fourth group...it becomes very slow...

    I have around 30 GB Free in my Hard Disk. My Pagefile Memory is set to around 1 GB. When I open my Task Manager at this point, my pagefile memory shows full and it gets hanged. Sometimes, my macro also shows the error and when I debug then it shows the yellow line on :
    Set oGraph = oshape.OLEFormat.Object
    ...please note that error is not because of Coding problem...I think I am not able to get the right point to vanish the objects because my powerpoints has around 150 Graphs in total which I need to update.

    Any Idea???
    Thanks,Vikas

  15. #15
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Memory Problem in VBA

    Debug your code by placing a breakpoint on your outter main for next loop. and then on the third iteration step through it by pressing F8. See there must be some issue or error that is causing it to hang. Tha is pegging the cpu since its probably waiting for a response or something.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  16. #16

    Thread Starter
    Member
    Join Date
    Jun 2006
    Posts
    35

    Re: Memory Problem in VBA

    Hmmmm..okay!!! I will try it once again....anyways, can you please check it once and suggest me if I have closed the oshape and ograph object at the right place or not??

    I feel that I am not able to judge where should I close the Objects as well....

    Any Idea??

    Regards,
    Vikas

  17. #17
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Memory Problem in VBA

    Depending on what your doing, it looks like its in the right loop.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  18. #18
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Memory Problem in VBA

    VB Code:
    1. Set oshape = Nothing
    2.                Set oGraph = Nothing
    Try reversing these two lines. Once you destroy oshape, what is oGraph? I don't think this will solve your problem - you may just need more memory than you have (probably a l ot more if you have 150 graphs and they're large and complex), causing the program to slow WAY down as it uses swapfile as memory.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  19. #19
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Memory Problem in VBA

    and for fun.. up the swapfile to 2GB.. jus to see what happens
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  20. #20

    Thread Starter
    Member
    Join Date
    Jun 2006
    Posts
    35

    Re: Memory Problem in VBA

    thnx for ur suggestion, i will work on ur suggestions, will tell u tmrw about the results..

    Thanks,Vikas

  21. #21

    Thread Starter
    Member
    Join Date
    Jun 2006
    Posts
    35

    Re: Memory Problem in VBA

    Hello Experts!

    I have noticed one more thing at the time of running this Macro. When I open Window Task Manager I can See there are lot of times Graph.exe file is running. When I end task all the files it works fine. Is there any function or code in the vb which deletes .exe files from the Windows Task Manager?

    Thanks,
    Vikas

  22. #22

    Thread Starter
    Member
    Join Date
    Jun 2006
    Posts
    35

    Re: Memory Problem in VBA

    Hello rob/static...

    just want to say thanks to you, and guess what, my problem is all set now..i just have to terminate the ograph application...and for that I need to put the following line after updating the graph:
    VB Code:
    1. oGraph.Application.Quit

    And now, I am on the Seventh Sky ...isn't it great!!!!!!

    Thanks for all your support!!!!!!

    Regards,
    Vikas Bhandari

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width