<div dir="ltr">Dear All of amazing Peoples<div><br clear="all"><div><div>I write code in vb6 and create report in Ms excell, but I want to create report using LibreOffice. Can someone help me to changes my code? <br></div>
</div><div><br></div><div><div><font size="1" color="#0000ff">Option Explicit</font></div><div><font size="1" color="#0000ff"><br></font></div><div><font size="1" color="#0000ff">Dim MyExcel As Excel.Application</font></div>
<div><font size="1" color="#0000ff">Dim MyExcelWorkBook As Excel.Workbook</font></div><div><font size="1" color="#0000ff">Dim MyExcelWorksheet As Excel.Worksheet</font></div><div><font size="1" color="#0000ff"><br></font></div>
<div><font size="1" color="#0000ff">Public Enum XllineType</font></div><div><font size="1" color="#0000ff"> lnormal = 1</font></div><div><font size="1" color="#0000ff"> LDash = -4115</font></div><div><font size="1" color="#0000ff"> LDashDot = 4</font></div>
<div><font size="1" color="#0000ff"> LDashDotDot = 5</font></div><div><font size="1" color="#0000ff"> LDot = -4118</font></div><div><font size="1" color="#0000ff"> LDouble = -4119</font></div><div><font size="1" color="#0000ff"> LSlantDashDot = 13</font></div>
<div><font size="1" color="#0000ff"> LNone = -4142</font></div><div><font size="1" color="#0000ff">End Enum</font></div><div><font size="1" color="#0000ff"><br></font></div><div><font size="1" color="#0000ff">Public Enum XlLinePos</font></div>
<div><font size="1" color="#0000ff"> LDiagonalDown = 5</font></div><div><font size="1" color="#0000ff"> LLeft = 7</font></div><div><font size="1" color="#0000ff"> LTop = 8</font></div><div><font size="1" color="#0000ff"> LBottom = 9</font></div>
<div><font size="1" color="#0000ff"> LRight = 10</font></div><div><font size="1" color="#0000ff">End Enum</font></div><div><font size="1" color="#0000ff"><br></font></div><div><font size="1" color="#0000ff">Public Enum XlAlignment</font></div>
<div><font size="1" color="#0000ff"> xlCenter = -4108</font></div><div><font size="1" color="#0000ff"> xlLeft = -4131</font></div><div><font size="1" color="#0000ff"> xlRight = -4152</font></div><div><font size="1" color="#0000ff"> xlTop = -4160</font></div>
<div><font size="1" color="#0000ff"> xlBottom = -4107</font></div><div><font size="1" color="#0000ff">End Enum</font></div><div><font size="1" color="#0000ff"><br></font></div><div><font size="1" color="#0000ff">Public Sub OpenExcel(Optional Show As Boolean = True)</font></div>
<div><font size="1" color="#0000ff"> Set MyExcel = CreateObject("Excel.Application")</font></div><div><font size="1" color="#0000ff"> MyExcel.Visible = Show</font></div><div><font size="1" color="#0000ff">End Sub</font></div>
<div><font size="1" color="#0000ff"><br></font></div><div><font size="1" color="#0000ff">Public Sub OpenWorkBook(Optional PathAndNameXls As String = "", Optional Psw1 As String = "", Optional Psw2 As String = "")</font></div>
<div><font size="1" color="#0000ff"> If PathAndNameXls = "" Then</font></div><div><font size="1" color="#0000ff"> Set MyExcelWorkBook = MyExcel.Workbooks.Add</font></div><div><font size="1" color="#0000ff"> Set MyExcelWorksheet = MyExcelWorkBook.Sheets(1)</font></div>
<div><font size="1" color="#0000ff"> Else</font></div><div><font size="1" color="#0000ff"> Set MyExcelWorkBook = MyExcel.Workbooks.Open(PathAndNameXls, , , , Psw1, Psw2)</font></div><div><font size="1" color="#0000ff"> Set MyExcelWorksheet = MyExcelWorkBook.Sheets(1)</font></div>
<div><font size="1" color="#0000ff"> End If</font></div><div><font size="1" color="#0000ff">End Sub</font></div><div><font size="1" color="#0000ff"><br></font></div><div><font size="1" color="#0000ff">Public Sub CloseWorkBook(Optional NoConfirm As Boolean = True)</font></div>
<div><font size="1" color="#0000ff"> MyExcelWorkBook.Saved = NoConfirm</font></div><div><font size="1" color="#0000ff"> MyExcelWorkBook.Close</font></div><div><font size="1" color="#0000ff">End Sub</font></div><div><font size="1" color="#0000ff"><br>
</font></div><div><font size="1" color="#0000ff">Public Sub CloseExcel()</font></div><div><font size="1" color="#0000ff"> MyExcel.Quit</font></div><div><font size="1" color="#0000ff"> Set MyExcel = Nothing</font></div><div>
<font size="1" color="#0000ff">End Sub</font></div><div><font size="1" color="#0000ff">Public Sub ExcelPrintPreview()</font></div><div><font size="1" color="#0000ff"> MyExcel.Visible = True</font></div><div><font size="1" color="#0000ff"> MyExcelWorksheet.PrintPreview</font></div>
<div><font size="1" color="#0000ff"> MyExcel.Visible = False</font></div><div><font size="1" color="#0000ff">End Sub</font></div><div><font size="1" color="#0000ff"><br></font></div><div><font size="1" color="#0000ff">Public Sub PutExcelValue(y As Long, X As Long, s As String)</font></div>
<div><font size="1" color="#0000ff"> MyExcelWorksheet.Cells(y, X).Value = s</font></div><div><font size="1" color="#0000ff">End Sub</font></div><div><font size="1" color="#0000ff"><br></font></div><div><font size="1" color="#0000ff">Public Sub SetCellFontSize(y As Long, X As Long, size As Long)</font></div>
<div><font size="1" color="#0000ff"> MyExcelWorksheet.Cells(y, X).Font.size = size</font></div><div><font size="1" color="#0000ff">End Sub</font></div><div><font size="1" color="#0000ff"><br></font></div><div><font size="1" color="#0000ff">Public Sub SetCellFontBold(y As Long, X As Long)</font></div>
<div><font size="1" color="#0000ff"> MyExcelWorksheet.Cells(y, X).Font.Bold = True</font></div><div><font size="1" color="#0000ff">End Sub</font></div><div><font size="1" color="#0000ff">Public Sub SetCellFontItalic(y As Long, X As Long)</font></div>
<div><font size="1" color="#0000ff"> MyExcelWorksheet.Cells(y, X).Font.Italic = True</font></div><div><font size="1" color="#0000ff">End Sub</font></div><div><font size="1" color="#0000ff"><br></font></div><div><font size="1" color="#0000ff">Public Sub SetHorisontalAlignment(y As Long, X As Long, alg As XlAlignment)</font></div>
<div><font size="1" color="#0000ff"> MyExcelWorksheet.Cells(y, X).HorizontalAlignment = alg</font></div><div><font size="1" color="#0000ff">End Sub</font></div><div><font size="1" color="#0000ff"><br></font></div><div><font size="1" color="#0000ff">Public Sub SetBorderLine(y As Long, X As Long, lpos As XlLinePos, ltype As XllineType)</font></div>
<div><font size="1" color="#0000ff"> MyExcelWorksheet.Cells(y, X).Borders(lpos).LineStyle = ltype</font></div><div><font size="1" color="#0000ff">End Sub</font></div><div><font size="1" color="#0000ff"><br></font></div><div>
<font size="1" color="#0000ff">Public Sub CopyRange(Range1 As String, Range2 As String, Destination As String)</font></div><div><font size="1" color="#0000ff"> MyExcelWorksheet.Range(Range1 & ":" & Range2).Copy Destination:=MyExcelWorksheet.Range(Destination)</font></div>
<div><font size="1" color="#0000ff">End Sub</font></div><div><font size="1" color="#0000ff"><br></font></div><div><font size="1" color="#0000ff">Sub PrintJurnal(noref As String)</font></div><div><font size="1" color="#0000ff">Dim rs As New ADODB.Recordset</font></div>
<div><font size="1" color="#0000ff"><br></font></div><div><font size="1" color="#0000ff">Dim Total As Double</font></div><div><font size="1" color="#0000ff"><br></font></div><div><font size="1" color="#0000ff">Dim NameAkun As String</font></div>
<div><font size="1" color="#0000ff">Dim i As Long</font></div><div><font size="1" color="#0000ff">Dim Row As Long</font></div><div><font size="1" color="#0000ff"><br></font></div><div><font size="1" color="#0000ff"> OpenExcel True</font></div>
<div><font size="1" color="#0000ff"> OpenWorkBook App.Path & "\jurnaldet.xls"</font></div><div><font size="1" color="#0000ff"> </font></div><div><font size="1" color="#0000ff"> Set rs = ExecSQL(GetDSN, "SELECT * FROM global")</font></div>
<div><font size="1" color="#0000ff"> If rs.RecordCount > 0 Then</font></div><div><font size="1" color="#0000ff"> PutExcelValue 2, 1, rs!Nama</font></div><div><font size="1" color="#0000ff"> PutExcelValue 3, 1, rs!alamat & " - " & rs!kota</font></div>
<div><font size="1" color="#0000ff"> PutExcelValue 4, 1, rs!notelp</font></div><div><font size="1" color="#0000ff"> End If</font></div><div><font size="1" color="#0000ff"> </font></div><div><font size="1" color="#0000ff"> Set rs = ExecSQL(GetDSN, "SELECT * FROM totjurnal " & _</font></div>
<div><font size="1" color="#0000ff"> "WHERE referensi='" & noref & "'")</font></div><div><font size="1" color="#0000ff"> If rs.RecordCount > 0 Then</font></div><div><font size="1" color="#0000ff"> 'get header</font></div>
<div><font size="1" color="#0000ff"> PutExcelValue 5, 2, ": " & noref</font></div><div><font size="1" color="#0000ff"> PutExcelValue 5, 7, "User : " & rs!user</font></div><div><font size="1" color="#0000ff"> PutExcelValue 6, 2, ": " & Format(rs!tanggal, "dd-mm-yyyy")</font></div>
<div><font size="1" color="#0000ff"> PutExcelValue 7, 2, ": " & rs!keterangan</font></div><div><font size="1" color="#0000ff"> </font></div><div><font size="1" color="#0000ff"> Total = rs!debit</font></div>
<div><font size="1" color="#0000ff"> Row = 9</font></div><div><font size="1" color="#0000ff"> 'get detail</font></div><div><font size="1" color="#0000ff"> Set rs = ExecSQL(GetDSN, "SELECT * FROM detjurnal " & _</font></div>
<div><font size="1" color="#0000ff"> "WHERE referensi='" & noref & "' ORDER BY nourut")</font></div><div><font size="1" color="#0000ff"> If rs.RecordCount > 0 Then</font></div>
<div><font size="1" color="#0000ff"> For i = 0 To rs.RecordCount - 1</font></div><div><font size="1" color="#0000ff"> PutExcelValue Row + i, 1, "'" & Trim(i + 1) & "."</font></div>
<div><font size="1" color="#0000ff"> </font></div><div><font size="1" color="#0000ff"> NamaAkun = GetKeterangan(GetDSN, "rekening", "kode", "namaakun", rs!kodeakun)</font></div>
<div><font size="1" color="#0000ff"> PutExcelValue Row + i, 2, rs!kodeakun</font></div><div><font size="1" color="#0000ff"> PutExcelValue Row + i, 3, NamaAkun</font></div><div><font size="1" color="#0000ff"> If rs!debit > 0 Then</font></div>
<div><font size="1" color="#0000ff"> PutExcelValue Row + i, 6, Format(rs!debit, "#,##0.00")</font></div><div><font size="1" color="#0000ff"> Row = Row + 1</font></div><div><font size="1" color="#0000ff"> PutExcelValue Row + i, 3, rs!keterangan</font></div>
<div><font size="1" color="#0000ff"> Else</font></div><div><font size="1" color="#0000ff"> PutExcelValue Row + i, 7, Format(rs!kredit, "#,##0.00")</font></div><div><font size="1" color="#0000ff"> Row = Row + 1</font></div>
<div><font size="1" color="#0000ff"> PutExcelValue Row + i, 3, rs!keterangan</font></div><div><font size="1" color="#0000ff"> End If</font></div><div><font size="1" color="#0000ff"> </font></div><div>
<font size="1" color="#0000ff"> 'format text</font></div><div><font size="1" color="#0000ff"> SetCellFontSize Row + i, 3, 8</font></div><div><font size="1" color="#0000ff"> SetHorisontalAlignment Row + i - 1, 6, xlRight</font></div>
<div><font size="1" color="#0000ff"> SetHorisontalAlignment Row + i - 1, 7, xlRight</font></div><div><font size="1" color="#0000ff"> </font></div><div><font size="1" color="#0000ff"> rs.MoveNext</font></div>
<div><font size="1" color="#0000ff"> Next i</font></div><div><font size="1" color="#0000ff"> </font></div><div><font size="1" color="#0000ff"> PutExcelValue Row + rs.RecordCount, 5, "Total:"</font></div>
<div><font size="1" color="#0000ff"> PutExcelValue Row + rs.RecordCount, 6, Format(Total, "#,##0.00")</font></div><div><font size="1" color="#0000ff"> </font></div><div><font size="1" color="#0000ff"> SetHorisontalAlignment Row + rs.RecordCount, 5, xlRight</font></div>
<div><font size="1" color="#0000ff"> SetHorisontalAlignment Row + rs.RecordCount, 6, xlRight</font></div><div><font size="1" color="#0000ff"> </font></div><div><font size="1" color="#0000ff"> </font></div><div>
<font size="1" color="#0000ff"> 'border</font></div><div><font size="1" color="#0000ff"> For i = 1 To 8</font></div><div><font size="1" color="#0000ff"> SetBorderLine Row + rs.RecordCount, i, LTop, lnormal</font></div>
<div><font size="1" color="#0000ff"> Next i</font></div><div><font size="1" color="#0000ff"> End If</font></div><div><font size="1" color="#0000ff"> PutExcelValue Row + rs.RecordCount + 1, 1, "Terbilang : " & SayN(Total) & "Rupiah"</font></div>
<div><font size="1" color="#0000ff"> SetCellFontSize Row + rs.RecordCount + 1, 1, 8</font></div><div><font size="1" color="#0000ff"> SetCellFontItalic Row + rs.RecordCount + 1, 1</font></div><div><font size="1" color="#0000ff"> End If</font></div>
<div><font size="1" color="#0000ff"> </font></div><div><font size="1" color="#0000ff"> ExcelPrintPreview</font></div><div><font size="1" color="#0000ff"> CloseWorkBook</font></div><div><font size="1" color="#0000ff"> CloseExcel</font></div>
<div><font size="1" color="#0000ff"><br></font></div><div><font size="1" color="#0000ff">End Sub</font></div></div><div><br></div>Thanks before<br><div dir="ltr"><span style="font-family:times,serif;font-size:16px"><pre style="margin:0in 0in 0.0001pt;font-size:10pt;font-family:'Courier New';color:black">
Best Regards,</pre><pre style="margin:0in 0in 0.0001pt;font-size:10pt;font-family:'Courier New';color:black"><br></pre>Henokh Yu.<pre style="margin:0in 0in 0.0001pt;font-size:10pt;font-family:'Courier New';color:black">
<span style="font-family:times,serif;font-size:16px"><pre style="margin:0in 0in 0.0001pt;font-size:10pt;font-family:'Courier New';color:black"><br></pre></span></pre></span></div>
</div></div>