katy2000

Application.caption

Discussion created by katy2000 on Mar 21, 2011
Hi everybody!!! another question We need put a "substring" in the name of pdf
any help 'll appreciate thank you
Public Sub ImprimerPDF()
    ' Impresion du fichier PDF
    Dim pMxDoc As IMxDocument
    Set pMxDoc = ThisDocument
   
    ' La vue active
    Dim pActiveView As IActiveView
    Set pActiveView = pMxDoc.ActiveView
 
    Dim strFileName As String
    ' Si la view active est Pagelayout
        ' le nom du fichier est le nom de l'application
    If TypeOf pActiveView Is IPageLayout Then
       strFileName = Application.Caption    Else
        ' Sinon, est le nom du Map
        strFileName = frmMain.cmbCartes.text
    End If
   
    Dim pExport As IExport
    Set pExport = New ExportPDF
   
    ' Construction du nom de fichier
    Dim strExportFileName As String
    strExportFileName = strFileName + ".pdf"
    pExport.ExportFileName = strExportFileName
    'Definition de paramters d'exportation
    pExport.Resolution = 96
    Dim exportRECT As tagRECT
    exportRECT = pActiveView.ExportFrame
    Dim pPixelBoundsEnv As IEnvelope
    Set pPixelBoundsEnv = New Envelope
    pPixelBoundsEnv.PutCoords exportRECT.Left, exportRECT.Top, exportRECT.Right, exportRECT.bottom
    pExport.PixelBounds = pPixelBoundsEnv
    ' Debut de l'exportation
    Dim hDC As Long
    hDC = pExport.StartExporting
    pActiveView.Output hDC, pExport.Resolution, exportRECT, Nothing, Nothing
  'Finish writing the export file and cleanup any intermediate files.
    pExport.FinishExporting
    pExport.Cleanup
    ' mesaage de resultat
    Dim vbresult As Integer
    vbresult = MsgBox(strExportFileName & vbCrLf & "DONE!", vbInformation, "Exportation vers fichier PDF")
End Sub

Outcomes