home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / crystal / extras / vbxdemo / export.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-12-15  |  14.0 KB  |  411 lines

  1. VERSION 2.00
  2. Begin Form Export 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Export"
  6.    ClientHeight    =   2400
  7.    ClientLeft      =   1260
  8.    ClientTop       =   1455
  9.    ClientWidth     =   7140
  10.    Height          =   2805
  11.    Left            =   1200
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   2400
  16.    ScaleWidth      =   7140
  17.    Top             =   1110
  18.    Width           =   7260
  19.    Begin CommandButton ExportHelp 
  20.       Caption         =   "Help"
  21.       Height          =   375
  22.       Left            =   4440
  23.       TabIndex        =   5
  24.       Top             =   1800
  25.       Width           =   1605
  26.    End
  27.    Begin CommandButton ExportCancel 
  28.       Caption         =   "Cancel"
  29.       Height          =   375
  30.       Left            =   2730
  31.       TabIndex        =   4
  32.       Top             =   1800
  33.       Width           =   1605
  34.    End
  35.    Begin CommandButton ExportOk 
  36.       Caption         =   "Ok"
  37.       Height          =   375
  38.       Left            =   1020
  39.       TabIndex        =   3
  40.       Top             =   1800
  41.       Width           =   1605
  42.    End
  43.    Begin SSFrame Frame3D1 
  44.       Font3D          =   0  'None
  45.       Height          =   1320
  46.       Left            =   180
  47.       TabIndex        =   0
  48.       Top             =   225
  49.       Width           =   6705
  50.       Begin TextBox DestText 
  51.          Height          =   295
  52.          Left            =   3510
  53.          TabIndex        =   2
  54.          Text            =   "Disk File"
  55.          Top             =   675
  56.          Width           =   2625
  57.       End
  58.       Begin TextBox FormatText 
  59.          Height          =   295
  60.          Left            =   300
  61.          TabIndex        =   1
  62.          Text            =   "Character-separated values"
  63.          Top             =   675
  64.          Width           =   2715
  65.       End
  66.       Begin ComboBox DestCombo 
  67.          Height          =   300
  68.          Left            =   3630
  69.          Style           =   2  'Dropdown List
  70.          TabIndex        =   7
  71.          Top             =   675
  72.          Width           =   2745
  73.       End
  74.       Begin ComboBox FormatCombo 
  75.          Height          =   300
  76.          Left            =   360
  77.          Style           =   2  'Dropdown List
  78.          TabIndex        =   6
  79.          Top             =   675
  80.          Width           =   2895
  81.       End
  82.       Begin Label Label2 
  83.          BackColor       =   &H00C0C0C0&
  84.          Caption         =   "Destination:"
  85.          Height          =   240
  86.          Left            =   3540
  87.          TabIndex        =   9
  88.          Top             =   315
  89.          Width           =   1185
  90.       End
  91.       Begin Label Label1 
  92.          BackColor       =   &H00C0C0C0&
  93.          Caption         =   "Format:"
  94.          Height          =   240
  95.          Left            =   300
  96.          TabIndex        =   8
  97.          Top             =   360
  98.          Width           =   1095
  99.       End
  100.    End
  101. Sub Combo1_Click ()
  102. End Sub
  103. Sub DestCombo_Click ()
  104.    DestText.Text = DestCombo.Text
  105. End Sub
  106. Sub ExportCancel_Click ()
  107.  Unload Me
  108. End Sub
  109. Sub ExportOk_Click ()
  110. CancelCheck = 0
  111. If DestText.Text = "Disk File" Then
  112.    If FormatText.Text = "Character-separated values" Then
  113.      
  114.      CharSep.Show 1
  115.      NDFormatform.Show 1
  116.      If CancelCheck <> 1 Then
  117.        On Error GoTo ErrorHandlerc
  118.        Main.CMDialog1.CancelError = True
  119.        Main.CMDialog1.Flags = OFN_HIDEREADONLY
  120.        Main.CMDialog1.DialogTitle = "Choose Export File"
  121.        Main.CMDialog1.Filter = "Character-seperated(*.chr)"
  122.        Main.CMDialog1.Filename = "*.chr"
  123.        Main.CMDialog1.Action = 1
  124.        Main.Report1.PrintFileName = Main.CMDialog1.Filename
  125.        Main.Report1.PrintFileType = 5
  126.      Else
  127.        Exit Sub
  128.      End If
  129.    Else
  130.      If FormatText.Text = "Comma-separated values(CSV)" Then
  131.         
  132.         NDFormatform.Show 1
  133.         
  134.          If CancelCheck <> 1 Then
  135.            On Error GoTo ErrorHandlerc
  136.            Main.CMDialog1.CancelError = True
  137.            Main.CMDialog1.Flags = OFN_HIDEREADONLY
  138.            Main.CMDialog1.DialogTitle = "Choose Export File"
  139.            Main.CMDialog1.Filter = "Comma-seperated(*.csv)"
  140.            Main.CMDialog1.Filename = "*.csv"
  141.            Main.CMDialog1.Action = 1
  142.            Main.Report1.PrintFileName = Main.CMDialog1.Filename
  143.            Main.Report1.PrintFileType = 4
  144.          Else
  145.           Exit Sub
  146.          End If
  147.      Else
  148.        If FormatText.Text = "Crystal Reports(RPT)" Then
  149.          
  150.           If CancelCheck <> 1 Then
  151.             On Error GoTo ErrorHandlerc
  152.             Main.CMDialog1.CancelError = True
  153.             Main.CMDialog1.Flags = OFN_HIDEREADONLY
  154.             Main.CMDialog1.DialogTitle = "Choose Export File"
  155.             Main.CMDialog1.Filter = "Crystal Report(*.rpt)"
  156.             Main.CMDialog1.Filename = "*.rpt"
  157.             Main.CMDialog1.Action = 1
  158.             Main.Report1.PrintFileName = Main.CMDialog1.Filename
  159.             Main.Report1.PrintFileType = 7
  160.           Else
  161.            Exit Sub
  162.           End If
  163.        Else
  164.         If FormatText.Text = "Excel 4.0(XLS)" Then
  165.          
  166.           If CancelCheck <> 1 Then
  167.             On Error GoTo ErrorHandlerc
  168.             Main.CMDialog1.CancelError = True
  169.             Main.CMDialog1.Flags = OFN_HIDEREADONLY
  170.             Main.CMDialog1.DialogTitle = "Choose Export File"
  171.             Main.CMDialog1.Filter = "Excel 4.0 (*.xls)"
  172.             Main.CMDialog1.Filename = "*.xls"
  173.             Main.CMDialog1.Action = 1
  174.             Main.Report1.PrintFileName = Main.CMDialog1.Filename
  175.             Main.Report1.PrintFileType = 10
  176.           Else
  177.            Exit Sub
  178.           End If
  179.         Else
  180.           If FormatText.Text = "Word for Windows" Then
  181.             
  182.              If CancelCheck <> 1 Then
  183.                On Error GoTo ErrorHandlerc
  184.                Main.CMDialog1.CancelError = True
  185.                Main.CMDialog1.Flags = OFN_HIDEREADONLY
  186.                Main.CMDialog1.DialogTitle = "Choose Export File"
  187.                Main.CMDialog1.Filter = "Word for Windows(*.doc)"
  188.                Main.CMDialog1.Filename = "*.doc"
  189.                Main.CMDialog1.Action = 1
  190.                Main.Report1.PrintFileName = Main.CMDialog1.Filename
  191.                Main.Report1.PrintFileType = 17
  192.              Else
  193.                Exit Sub
  194.              End If
  195.           Else
  196.             If FormatText.Text = "Lotus(WKS)" Then
  197.                Unload Me
  198.                If CancelCheck <> 1 Then
  199.                   On Error GoTo ErrorHandlerc
  200.                   Main.CMDialog1.CancelError = True
  201.                   Main.CMDialog1.Flags = OFN_HIDEREADONLY
  202.                   Main.CMDialog1.DialogTitle = "Choose Export File"
  203.                   Main.CMDialog1.Filter = "Lotus(*.wks)"
  204.                   Main.CMDialog1.Filename = "*.wks"
  205.                   Main.CMDialog1.Action = 1
  206.                   Main.Report1.PrintFileName = Main.CMDialog1.Filename
  207.                   Main.Report1.PrintFileType = 13
  208.                Else
  209.                  Exit Sub
  210.                End If
  211.             Else
  212.               Exit Sub
  213.             End If
  214.           End If
  215.         End If
  216.        End If
  217.      End If
  218.    End If
  219.      Main.Report1.Destination = 2
  220.      If Main.Report1.PrintReport <> 0 Then
  221.        Screen.MousePointer = 0
  222.        MsgBox "Exporting has caused Error#: " & Main.Report1.LastErrorNumber & " - " & Main.Report1.LastErrorString
  223.        Exit Sub
  224.      Else
  225.       Main!StatusBar.Caption = "Export Successful."
  226.       'Enable the Close menu item under file inorder to
  227.       'allow the user to close the window from a menu
  228.       'as well as the windows control box
  229.       Screen.MousePointer = 0
  230.       Unload Me
  231.      End If
  232.  If DestText.Text = "Microsoft Mail(MAPI)" Then
  233.    If FormatText.Text = "Character-separated values" Then
  234.      
  235.      CharSep.Show 1
  236.      NDFormatform.Show 1
  237.      If CancelCheck <> 1 Then
  238.        On Error GoTo ErrorHandlerc
  239.        Main.CMDialog1.CancelError = True
  240.        Main.CMDialog1.Flags = OFN_HIDEREADONLY
  241.        Main.CMDialog1.DialogTitle = "Choose Export File"
  242.        Main.CMDialog1.Filter = "Character-seperated(*.chr)"
  243.        Main.CMDialog1.Filename = "*.chr"
  244.        Main.CMDialog1.Action = 1
  245.        Main.Report1.PrintFileName = Main.CMDialog1.Filename
  246.        Main.Report1.PrintFileType = 5
  247.      Else
  248.        Exit Sub
  249.      End If
  250.    Else
  251.      If FormatText.Text = "Comma-separated values(CSV)" Then
  252.         
  253.         NDFormatform.Show 1
  254.          If CancelCheck <> 1 Then
  255.            On Error GoTo ErrorHandlerc
  256.            Main.CMDialog1.CancelError = True
  257.            Main.CMDialog1.Flags = OFN_HIDEREADONLY
  258.            Main.CMDialog1.DialogTitle = "Choose Export File"
  259.            Main.CMDialog1.Filter = "Comma-seperated(*.csv)"
  260.            Main.CMDialog1.Filename = "*.csv"
  261.            Main.CMDialog1.Action = 1
  262.            Main.Report1.PrintFileName = Main.CMDialog1.Filename
  263.            Main.Report1.PrintFileType = 4
  264.          Else
  265.           Exit Sub
  266.          End If
  267.      Else
  268.        If FormatText.Text = "Crystal Reports(RPT)" Then
  269.          
  270.           If CancelCheck <> 1 Then
  271.             On Error GoTo ErrorHandlerc
  272.             Main.CMDialog1.CancelError = True
  273.             Main.CMDialog1.Flags = OFN_HIDEREADONLY
  274.             Main.CMDialog1.DialogTitle = "Choose Export File"
  275.             Main.CMDialog1.Filter = "Crystal Report(*.rpt)"
  276.             Main.CMDialog1.Filename = "*.rpt"
  277.             Main.CMDialog1.Action = 1
  278.             Main.Report1.PrintFileName = Main.CMDialog1.Filename
  279.             Main.Report1.PrintFileType = 7
  280.           Else
  281.            Exit Sub
  282.           End If
  283.        Else
  284.         If FormatText.Text = "Excel 4.0(XLS)" Then
  285.          
  286.           If CancelCheck <> 1 Then
  287.             On Error GoTo ErrorHandlerc
  288.             Main.CMDialog1.CancelError = True
  289.             Main.CMDialog1.Flags = OFN_HIDEREADONLY
  290.             Main.CMDialog1.DialogTitle = "Choose Export File"
  291.             Main.CMDialog1.Filter = "Excel 4.0 (*.xls)"
  292.             Main.CMDialog1.Filename = "*.xls"
  293.             Main.CMDialog1.Action = 1
  294.             Main.Report1.PrintFileName = Main.CMDialog1.Filename
  295.             Main.Report1.PrintFileType = 10
  296.           Else
  297.            Exit Sub
  298.           End If
  299.         Else
  300.           If FormatText.Text = "Word for Windows" Then
  301.             
  302.              If CancelCheck <> 1 Then
  303.                On Error GoTo ErrorHandlerc
  304.                Main.CMDialog1.CancelError = True
  305.                Main.CMDialog1.Flags = OFN_HIDEREADONLY
  306.                Main.CMDialog1.DialogTitle = "Choose Export File"
  307.                Main.CMDialog1.Filter = "Word for Windows(*.doc)"
  308.                Main.CMDialog1.Filename = "*.doc"
  309.                Main.CMDialog1.Action = 1
  310.                Main.Report1.PrintFileName = Main.CMDialog1.Filename
  311.                Main.Report1.PrintFileType = 17
  312.              Else
  313.                Exit Sub
  314.              End If
  315.           Else
  316.             If FormatText.Text = "Lotus(WKS)" Then
  317.                
  318.                If CancelCheck <> 1 Then
  319.                   On Error GoTo ErrorHandlerc
  320.                   Main.CMDialog1.CancelError = True
  321.                   Main.CMDialog1.Flags = OFN_HIDEREADONLY
  322.                   Main.CMDialog1.DialogTitle = "Choose Export File"
  323.                   Main.CMDialog1.Filter = "Lotus(*.wks)"
  324.                   Main.CMDialog1.Filename = "*.wks"
  325.                   Main.CMDialog1.Action = 1
  326.                   Main.Report1.PrintFileName = Main.CMDialog1.Filename
  327.                   Main.Report1.PrintFileType = 13
  328.                Else
  329.                  Exit Sub
  330.                End If
  331.             Else
  332.               Exit Sub
  333.             End If
  334.           End If
  335.         End If
  336.        End If
  337.      End If
  338.    End If
  339.      Main.Report1.Destination = 3
  340.      Email.Show 1
  341.      If CancelCheck <> 1 Then
  342.        If Main.Report1.PrintReport <> 0 Then
  343.          Screen.MousePointer = 0
  344.          MsgBox "Export to E-mail has caused Error#: " & Main.Report1.LastErrorNumber & " - " & Main.Report1.LastErrorString
  345.          Exit Sub
  346.        Else
  347.          Main!StatusBar.Caption = "Export Successful."
  348.          'Enable the Close menu item under file inorder to
  349.          'allow the user to close the window from a menu
  350.          'as well as the windows control box
  351.           Screen.MousePointer = 0
  352.           Unload Me
  353.        End If
  354.      Else
  355.        Exit Sub
  356.      End If
  357.  End If
  358. End If
  359. Exit Sub
  360. ErrorHandlerc:
  361.   Exit Sub
  362. End Sub
  363. Sub Form_Load ()
  364.   FormatCombo.AddItem "Character-separated values"
  365.   FormatCombo.AddItem "Comma-separated values(CSV)"
  366.   FormatCombo.AddItem "Crystal Reports(RPT)"
  367.   'FormatCombo.AddItem "Data Interchange Format(DIF)"
  368.   'FormatCombo.AddItem "Excel 2.1(XLS)"
  369.   'FormatCombo.AddItem "Excel 3.0(XLS)"
  370.   FormatCombo.AddItem "Excel 4.0(XLS)"
  371.   'FormatCombo.AddItem "Lotus 1-2-3(WK1)"
  372.   'FormatCombo.AddItem "Lotus 1-2-3(WK3)"
  373.   FormatCombo.AddItem "Lotus(WKS)"
  374.   'FormatCombo.AddItem "Quattro Pro 5.0(WB1)"
  375.   'FormatCombo.AddItem "Rich Text Format"
  376.   'FormatCombo.AddItem "Tab-separated text"
  377.   'FormatCombo.AddItem "Tab-separated values"
  378.   'FormatCombo.AddItem "Record Format"
  379.   'FormatCombo.AddItem "Text"
  380.   'FormatCombo.AddItem "Word for Dos"
  381.   FormatCombo.AddItem "Word for Windows"
  382.   'FormatCombo.AddItem "WordPerfect"
  383.   DestCombo.AddItem "Disk File"
  384.   DestCombo.AddItem "Microsoft Mail(MAPI)"
  385. '  0 - Record
  386.  '   1 - Tab Separated
  387.  '   2 - Text
  388.  '   3 - DIF
  389.  '   4 - CSV
  390.  '   5 - Character Separated
  391.  '   6 - Tab Separated Text
  392.  '   7 - Crystal Reports RPT
  393.  '   8 - Excel 2.1 XLS
  394.  '   9 - Excel 3.0 XLS
  395.  '   10 - Excel 4.0 XLS
  396.  '   11 - Lotus 1-2-3 WK1
  397.   '  12 - Lotus 1-2-3 WK3
  398.   '  13 - Lotus 1-2-3 WKS
  399.   '  14 - Quattro Pro 5.0 WB1
  400.   '  15 - RTF
  401.   '  16 - Word for DOS
  402.   '  17 - Word for Windows
  403.   '  18 - WordPerfect
  404. End Sub
  405. Sub FormatCombo_Change ()
  406.  FormatText.Text = FormatCombo.Text
  407. End Sub
  408. Sub FormatCombo_Click ()
  409. FormatText.Text = FormatCombo.Text
  410. End Sub
  411.