Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '(globál deklarációk)
- Dim FileName As String
- Dim Path As String
- Dim Partnumber As String
- Dim Revision As String
- Dim SysDate, SysTime As String
- Dim InvDoc As Document
- '(fő program lényegében:)
- Public Sub izé()
- Call StüLiExport
- end sub
- '(ez a szopó szubrutin)
- Private Sub StüLiExport()
- SysTime = Format(Time, "HH:MM")
- SysDate = Format(Date, "mm.dd.yy")
- For i = 1 To InvDoc.Sheets.Count
- If InvDoc.Sheets.Item(i).PartsLists.Count > 0 Then
- Dim StüLi As PartsList
- Set StüLi = InvDoc.Sheets.Item(i).PartsLists.Item(1)
- Exit For
- End If
- Next
- Dim XLSFileName As String
- XLSFileName = Path & FileName & Revision & ".xls"
- ' innen az érdekes:
- Dim ExcelApp As Excel.Application
- Set ExcelApp = New Excel.Application
- Dim ExcelWB As Excel.Workbook
- Set ExcelWB = ExcelApp.Workbooks.Add
- Dim ExcelWS As Excel.Sheet
- Set ExcelWS = ExcelWB.ActiveSheet
- With ExcelWS
- For o = 1 To StüLi.PartsListColumns.Count
- .Cells(1, o).Value = StüLi.PartsListColumns.Item(o).Title
- .Cells(1, o).Font.Bold = True
- .Cells(1, o).BorderAround LineStyle:=xlSolid, Weight:=xlThin, ColorIndex:=xlColorIndexAutomatic
- .Cells(1, o).HorizontalAlignment = xlCenter
- Next o
- For s = 1 To StüLi.PartsListRows.Count
- For o = 1 To StüLi.PartsListRows.Item(s).Count
- .Cells(s + 1, o).Value = StüLi.PartsListRows.Item(s).Item(o).Value
- .Cells(s + 1, o).BorderAround LineStyle:=xlSolid, Weight:=xlThin, ColorIndex:=xlColorIndexAutomatic
- .Cells(s + 1, o).HorizontalAlignment = xlLeft
- Next o
- Next s
- o = o - 1
- ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇ
- 'ez a gond:
- .Range(Cells(1, 1), Cells(s, o)).BorderAround LineStyle:=ExcelApp.xlSolid, Weight:=xlMedium, ColorIndex:=xlColorIndexAutomatic
- '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- .Columns.AutoFit
- .Cells(s + 1, 1).Value = "Exportálva: " & SysDate & " " & SysTime
- .Cells(s + 2, 1).Value = "(File: " & InvDoc.FullFileName & ")"
- .Name = "Stückliste"
- End With
- ExcelWB.SaveAs FileName:=XLSFileName, FileFormat:=xlExcel8
- ExcelWB.Close False
- ExcelApp.DisplayAlerts = False
- ExcelApp.quit
- Set ExcelWS = Nothing
- Set ExcelWB = Nothing
- Set ExcelApp = Nothing
- On Error GoTo 0
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement