Consulting

Results 1 to 2 of 2

Thread: Attach a xml file to pdf

  1. #1
    VBAX Newbie
    Joined
    Aug 2010
    Posts
    1
    Location

    Attach a xml file to pdf

    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:

    [VBA]
    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

    [/VBA]

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

  2. #2
    Moderator VBAX Master geekgirlau's Avatar
    Joined
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,464
    Location
    Hi Frantyi - welcome to the Board.

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

    We are what we repeatedly do. Excellence, therefore, is not an act but a habit.
    Aristotle

Posting Permissions

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