Close a PDf Through Automation... so close to finishing!!

Kavy

Well-known Member
Joined
Jun 25, 2007
Messages
607
Hello,

So as in another thread I posted I am getting an error msg during runtime which I belive it only occurs becuase I can't close my pdf's I am automating.

Below are the objects I create, and how I am attempting to close them, I have been googling and can't figure this out! While the pdf is hidden, if I check my memory usuage it is still sucking up memory!

<code>
Objects Created:
Set gapp = CreateObject("AcroExch.App")
Set gAvDoc = CreateObject("AcroExch.AVDoc")
Set gpdDoc = CreateObject("AcroExch.PDDoc")
gpdDoc.Open(strfiLe) And gAvDoc.Open(strfiLe, strfiLe & "temp")
Set jso = gpdDoc.GetJSObject
set Aform = CreateObject("AFormAut.App")

'And now my attempt at closing, they all dont cause errors unless noted
gapp.Exit
gapp.CloseAllDocs
gAvDoc.Exit 'Causes an error in Runtime
gpdDoc.Close
Aform.Exit 'Also causes an error in runtime

Set gAvDoc = Nothing
Set pdDoc = Nothing
Set Aform = Nothing
Set jso = Nothing

</code>

Does anyone know how to finish off killing this pdf? Thank you
 
So my error from my other thread
http://www.mrexcel.com/forum/showthread.php?t=486375

is defnitly due to this memory loss. I stoped my process every so often manually, shut down adobe in the process window manaully, and my code doesnt give up.

Is there a way of monitoring how much memory adobe is taking up, and shutting it down if its to much, and restarting?

Well.... I can re-start it, and apperntly shutting it down doesnt work so well as this thread has taught me.
 
Upvote 0

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Forum statistics

Threads
1,215,582
Messages
6,125,659
Members
449,247
Latest member
wingedshoes

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