Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export a report with VB 1

Status
Not open for further replies.

AKarim

Technical User
Mar 20, 2000
41
EU
Hi<br>I'm automating the refresh and export into ttx format file of a report.<br>I have inserted the global32.bas & crwrap.bas.<br><br>Const crUXFXls8ExtType = 8<br>Dim result As Integer<br><br>result = crPEExportToDisk(hJob, _<br>&nbsp;&nbsp;&nbsp;&nbsp;&quot;C:\export.ttx&quot;, &quot;uxfsepv.dll&quot;, crUXFCommaSeparatedType%, _<br>&nbsp;&nbsp;&nbsp;&nbsp;0, 0, 0, 0)<br><br>The result gives &quot;0&quot; don't know if it works or not anyway, the file do not exist at final.<br>thanks to anyone to tell me if i'm doing something wrong<br>
 
For information :<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim Result As Integer<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim MainJob As Integer<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim InitFile As Integer<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim ExportName As String<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim CrystalName As String<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim UseSameNumberFormat As Integer<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim UseSameDateFormat As Integer<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim StringDelimiter As String<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim FieldDelimiter As String<br><br>&nbsp;&nbsp;&nbsp;&nbsp;ExportLandesk.Hide<br>&nbsp;&nbsp;&nbsp;&nbsp;'Ouverture du fichier<br>&nbsp;&nbsp;&nbsp;&nbsp;On Error GoTo LoadError<br>&nbsp;&nbsp;&nbsp;&nbsp;InitFile = FreeFile<br>&nbsp;&nbsp;&nbsp;&nbsp;Open &quot;C:\Donnees\Gestion de parc\ExportLandesk.ini&quot; For Input As #InitFile<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Line Input #InitFile, CrystalName<br>&nbsp;&nbsp;&nbsp;&nbsp;Line Input #InitFile, ExportName<br>'&nbsp;&nbsp;&nbsp;&nbsp;Label1.Caption = _<br>'&nbsp;&nbsp;&nbsp;&nbsp;&quot;Extraction et exportation des données de Landesk/datamart dans le fichier &quot; _<br>'&nbsp;&nbsp;&nbsp;&nbsp;& ExportName & &quot;. L'etat Crystal Reports : &quot; & CrystalName & &quot; est en cours d'utilisation.&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;' Open print engine<br>&nbsp;&nbsp;&nbsp;&nbsp;Result = PEOpenEngine()<br>&nbsp;&nbsp;&nbsp;&nbsp;' Open the selected report<br>&nbsp;&nbsp;&nbsp;&nbsp;MainJob = PEOpenPrintJob(CrystalName & vbNullChar)<br>&nbsp;&nbsp;&nbsp;&nbsp;' Set FormatDLLName and FormatType based on selected format type<br><br>&nbsp;&nbsp;&nbsp;&nbsp;'UseSameNumberFormat = 1 or 0 for True or False<br>&nbsp;&nbsp;&nbsp;&nbsp;'UseSameDateFormat = 1 or 0 for True or False<br>&nbsp;&nbsp;&nbsp;&nbsp;'StringDelimiter = String delimiter for character separated<br>&nbsp;&nbsp;&nbsp;&nbsp;'Value Format<br>&nbsp;&nbsp;&nbsp;&nbsp;'FieldDelimiter = Field delimiter for character separated value<br>&nbsp;&nbsp;&nbsp;&nbsp;'Format<br><br>&nbsp;&nbsp;&nbsp;&nbsp;' Set export options based on selected export destination<br>&nbsp;&nbsp;&nbsp;&nbsp;Result = crPEExportToDisk(MainJob, ExportName & vbNullChar, _<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;u2fsepv.dll&quot; & vbNullChar, crUXFTabSeparatedType, _<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;UseSameNumberFormat, _<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;UseSameDateFormat, StringDelimiter & vbNullChar, _<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FieldDelimiter & vbNullChar)<br><br>&nbsp;&nbsp;&nbsp;&nbsp;' Start the print job<br>&nbsp;&nbsp;&nbsp;&nbsp;Result = PEStartPrintJob(MainJob, 1)<br>&nbsp;&nbsp;&nbsp;&nbsp;' Close the print job<br>&nbsp;&nbsp;&nbsp;&nbsp;PEClosePrintJob (MainJob)<br>&nbsp;&nbsp;&nbsp;&nbsp;' Close the engine<br>&nbsp;&nbsp;&nbsp;&nbsp;PECloseEngine<br>&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;'Fermeture du fichier<br>&nbsp;&nbsp;&nbsp;&nbsp;Close InitFile<br>&nbsp;&nbsp;&nbsp;&nbsp;Unload ExportLandesk<br>&nbsp;&nbsp;&nbsp;&nbsp;Exit Sub<br>LoadError:<br>&nbsp;&nbsp;&nbsp;&nbsp;MsgBox &quot;Erreur &quot; & Str$(Err.Number) & _<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot; pendant la lecture du fichier d'initialisation :&quot; & vbCrLf & _<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Err.Description<br>End Sub<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top