PDA

View Full Version : Attach a xml file to pdf



Frantyi
08-10-2010, 03:43 AM
Hy everybody!

How I can attach a xml file to pdf?
My programing platform is VBA (Access 2003)
Adobe acrobat 8 Standard

Thak You
Frantyi

Code to print:


Const AcrobatName = "Adobe PDF"
Dim strDefaultPrinter As String
Public Sub PrintRep(szlszam As String, hova As String)
ChangeToAcrobat
DoCmd.OpenReport <report name>, acNormal
ChangePdfFileNameAndPosition <report name>, hova, szlszam + ".pdf"
ResetDefaultPrinter
End Sub
Sub DefaultPrinter()
strDefaultPrinter = Application.Printer.DeviceName
End Sub
Sub ResetDefaultPrinter()
Set Application.Printer = Application.Printers(strDefaultPrinter)
End Sub
Function ChangeToAcrobat()
DefaultPrinter
Set Application.Printer = Application.Printers(AcrobatName)
End Function
Sub ChangePdfFileName(NewFileName As String)
Call aht_apiWriteProfileString("Acrobat PDFWriter", "PDFFilename", NewFileName)
End Sub
Sub ChangePdfFileNameAndPosition(RiportName As String, NewPositon As String, NewName As String)
Dim hibaszam As Integer
hibaszam = 0
Wait (5)
varj:
If FileThere(RiportName + ".pdf") Then
FileCopy Environ("USERPROFILE") & "\My Documents\" + RiportName + ".pdf", NewPositon + NewName
Kill Environ("USERPROFILE") & "\My Documents\" + RiportName + ".pdf"
Else
Wait (5)
hibaszam = hibaszam + 1

If hibaszam = 15 Then
MsgBox ("Error: Hiba az állomány kezelésben, Valami Gáz van")
End
Else
GoTo varj
End If
End If
End Sub
Function FileThere(FileName As String) As Boolean
FileThere = (Dir(FileName) > "")
End Function
Sub Wait(tSecs As Single)
Dim sngSec As Single

sngSec = Timer + tSecs

Do While Timer < sngSec
DoEvents
Loop
End Sub



Edited 11-Aug-10 by geekgirlau. Reason: insert vba tags

geekgirlau
08-10-2010, 06:55 PM
Hi Frantyi - welcome to the Board.

When you post code, please be sure to use the VBA tags to make it easier to read.