My project adds text to Acrobat fillable fields using VBA written in Access 2003. I take records from my Access database, and populate it into different Acrobat Forms based on the field name in the Acrobat Form. I am able to do this, but there is one problem.
The problem is that as the code runs through populating text in the Acrobat Forms, Acrobat opens up each form, and makes it visible to the user. It populates quick, but it is still visible. I want this to run in the background, or at least be minimized in the windows taskbar. The users should not not know which form the Application is updating. It should be hidden or invisible. That is the goal at least :)
I know which line in the code causes it to Maximize, but if I remove that line, I receive an error about No Document Currently Open in Acrobat Viewer.
Here is the snippet of the code I am using. Any help would be greatly appreciated.
Dim gApp As Acrobat.CAcroApp
Dim avdoc As Acrobat.CAcroAVDoc
Dim gPDDoc As Acrobat.CAcroPDDoc
Const DOC_FOLDER As String = "C:\Trial"
Dim x As Boolean
Set gApp = CreateObject("AcroExch.App")
Set gPDDoc = CreateObject("AcroExch.PDDoc")
Set avdoc = CreateObject("AcroExch.AVDoc")
'Hides Acrobat - So Far So Good
gApp.Hide
Dim FormApp As AFORMAUTLib.AFormApp
Dim AcroForm As AFORMAUTLib.Fields
Dim Field As AFORMAUTLib.Field
'Open PDF that I choose. Acrobat still has not flashed on my screen
x = avdoc.Open(DOC_FOLDER & "\trial.pdf", "temp")
'Acrobat Now Pops up on my screen. However, I get an error without this line
avdoc.Maximize(1)
'Hides it again, right after it opens. This creates the a flash
gApp.Hide
Set FormApp = CreateObject("AFormAut.App")
'If the Maximize line is not there, this is where I receive error about document viewer
For Each Field In FormApp.Fields
If Field.Name = "Sample_FieldName" Then
Field.Value = TextToUse
End If
Next
Please let me know if you can think of a way to keep Acrobat hidden. Thank you.
http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_24194227.php
Let me know.
Thanks.