lounching APFill from VBA

Technical support for APFill users
Post Reply
Posts: 1
Joined: 18 Feb 2019, 07:03

lounching APFill from VBA

Post by sorin12003 »

I am trying to lounch APFill from VBA code and I have no success so far.

My code is generating a pdf file in current directory and I want to start APFill to process that pdf and generate a text result in the file: fisier_txt.

Dim apfill_exe As String
Dim Path As String
Dim fisier As String
Dim fisier_txt As String

Path = ActiveDocument.FilePath
fisier = Left$(ActiveDocument.FileName, Len(ActiveDocument.FileName) - 4) & ".pdf"
fisier_txt = Left$(ActiveDocument.FileName, Len(ActiveDocument.FileName) - 4) & ".txt"
apfill_exe = "c:\Program Files\APFill\APFill.exe -r150 -noprogress"

this line I cannot make to work:
Call Shell(Environ$("COMSPEC") & " /c " & apfill_exe & Path + "\" + fisier & fisier_txt, vbNormalFocus)

Please help
AVPSoft support
AVPSoft support
Posts: 326
Joined: 01 Nov 2004, 21:25

Re: lounching APFill from VBA

Post by support »


I think the issue can be in missing "" for a apfill.exe long path and files parameters. Also you should use keyword COVERAGE if you use output file name.

In case of long paths the result shell start line should be:

Code: Select all

"C:\Program Files\APFill\APFill.exe" coverage -r150 -noprogress "c:\input.pdf" "c:\output.txt"
Also It seems that you've missed spaces between connected strings. So the line should be:

Code: Select all

apfill_exe = """c:\Program Files\APFill\APFill.exe"" -r150 -noprogress"
Call Shell(Environ$("COMSPEC") & " /c " & apfill_exe &" "&""""& Path + "\" + fisier&""" """& Path + "\" +fisier_txt&"""", vbNormalFocus)

Post Reply