The Add-in is from my local Fcam distributor it´s not enable from Delcam
I post the hole code here!' last tested with 9.3.0.09
Public Sub Werkzeugliste
'Public Sub main
Dim MSWord As Word.Application
Dim Doc As Word.Document
Dim OpSheet As Word.Table
Dim SQL As String
Dim LastDate As Date
Dim Result As Boolean
Dim FMDoc As MFGDocument
Dim OldTOOL As String
Set FMDoc = Application.ActiveDocument
Set MSWord = New Word.Application
MSWord.Visible = True
Set Doc = MSWord.Documents.Add
' select entire document
MSWord.Selection.WholeStory
' delete entire selection
MSWord.Selection.Delete
' turn on table gridlines
MSWord.ActiveWindow.View.TableGridlines = True
' turn landscape
MSWord.ActiveDocument.PageSetup.Orientation =wdOrientLandscape
' set font size to 22 points
'MSWord.Selection.Font.Size = 22
' set font color to red
'MSWord.Selection.Font.ColorIndex = wdRed ' use wdAuto to turn it back
'MSWord.Selection.TypeText "Your Account details:" & vbNewLine
'MSWord.Selection.TypeParagraph
'MSWord.Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
'MSWord.Selection.Font.Size = 12
' add table and format it
Dim Rows As Integer
Rows = FMDoc.Operations.Count + 7 'Added 7 extra rows to account for the headers
Set OpSheet = Doc.Tables.Add(MSWord.Selection.Range, Rows, 7)
OpSheet.PreferredWidthType = wdPreferredWidthPercent
OpSheet.PreferredWidth = 200 ' MSWord.InchesToPoints(10)
OpSheet.AutoFormat wdTableFormatNone
OpSheet.Columns(1).Width = MSWord.InchesToPoints(0.

OpSheet.Columns(2).Width = MSWord.InchesToPoints(2.5)
OpSheet.Columns(3).Width = MSWord.InchesToPoints(2)
OpSheet.Columns(4).Width = MSWord.InchesToPoints(1)
OpSheet.Columns(5).Width = MSWord.InchesToPoints(1.4)
OpSheet.Columns(6).Width = MSWord.InchesToPoints(1)
OpSheet.Columns(7).Width = MSWord.InchesToPoints(1.5)
OpSheet.Rows.AllowBreakAcrossPages = False
'OpSheet.AutoFitBehavior(wdAutoFitWindow)
'OpSheet.AllowAutoFit = True
'OpSheet.Columns(2).Width = MSWord.CentimetersToPoints(3)
Dim firstrow As Integer
firstrow = 1
' merge the first row
OpSheet.Rows(firstrow).Cells.Merge
' set some shading on the first row
OpSheet.Rows(firstrow).Shading.Texture = wdTexture10Percent
' set a title
OpSheet.Rows(firstrow).Range.text = "Präzisionstechnik GmbH"
OpSheet.Rows(firstrow).Range.Font.Size = 27
' center the title
OpSheet.Rows(firstrow).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
' make it bold
OpSheet.Rows(firstrow).Range.Bold = True
firstrow = firstrow + 1
' merge the first row
OpSheet.Rows(firstrow).Cells.Merge
' set some shading on the first row
OpSheet.Rows(firstrow).Shading.Texture = wdTexture10Percent
' set a title
OpSheet.Rows(firstrow).Range.text = "Werkzeugliste"
OpSheet.Rows(firstrow).Range.Font.Size = 27
' center the title
OpSheet.Rows(firstrow).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
' make it bold
OpSheet.Rows(firstrow).Range.Bold = True
firstrow = firstrow + 1
Call OpSheet.Cell(firstrow, 4).Merge(OpSheet.Cell(firstrow, 7))
Call OpSheet.Cell(firstrow, 1).Merge(OpSheet.Cell(firstrow, 3))
OpSheet.Cell(firstrow, 1).Range.text = "Datei: " & FMDoc.Name
OpSheet.Cell(firstrow, 2).Range.text = "NC Programmname: " & FMDoc.PartName
OpSheet.Rows(firstrow).Range.Bold = True
firstrow = firstrow + 1
Call OpSheet.Cell(firstrow, 4).Merge(OpSheet.Cell(firstrow, 7))
Call OpSheet.Cell(firstrow, 1).Merge(OpSheet.Cell(firstrow, 3))
OpSheet.Cell(firstrow, 1).Range.text = "Einheit: " & IIf( FMDoc.Metric = True, "MM", "Inch" )
If TypeName( FMDoc ) = "IFMDocument" Then
OpSheet.Cell(firstrow, 2).Range.text = "Material: " & FMDoc.Stock.Material
End If
OpSheet.Rows(firstrow).Range.Bold = True
firstrow = firstrow + 1
Call OpSheet.Cell(firstrow, 4).Merge(OpSheet.Cell(firstrow, 7))
Call OpSheet.Cell(firstrow, 1).Merge(OpSheet.Cell(firstrow, 3))
If TypeName( FMDoc ) = "IFMDocument" Then
OpSheet.Cell(firstrow, 1).Range.text = "Setup: " & FMDoc.ActiveSetup
End If
OpSheet.Cell(firstrow, 2).Range.text = "Datum: " & Date
OpSheet.Rows(firstrow).Range.Bold = True
firstrow = firstrow + 1
Call OpSheet.Cell(firstrow, 4).Merge(OpSheet.Cell(firstrow, 7))
Call OpSheet.Cell(firstrow, 1).Merge(OpSheet.Cell(firstrow, 3))
Dim length As Double, wid As Double, thick As Double
Dim od As Double, id As Double, nsides As Long
Dim axisType As tagFMAxisType
Dim stockCurve As String
Dim stockType As tagFMStockType
If TypeName( FMDoc ) = "IFMDocument" Then
FMDoc.Stock.GetDimensions( stockType, length, wid, thick, od, id, axisType, nsides, stockCurve )
OpSheet.Cell(firstrow, 1).Range.text = "Rohteil: L" & length & " B" & wid & " H" & thick
End If
OpSheet.Cell(firstrow, 2).Range.text = "Programmiert:"
OpSheet.Rows(firstrow).Range.Bold = True
firstrow = firstrow + 1
' Populate Table
OpSheet.Cell(firstrow, 1).Range.text = "T Nr."
OpSheet.Cell(firstrow, 2).Range.text = "Tool Name"
OpSheet.Cell(firstrow, 3).Range.text = "Feature"
OpSheet.Cell(firstrow, 4).Range.text = "Speed"
OpSheet.Cell(firstrow, 5).Range.text = "Feed"
OpSheet.Cell(firstrow, 6).Range.text = "Depth"
OpSheet.Cell(firstrow, 7).Range.text = "Holder"
OpSheet.Rows(firstrow).Range.Bold = True
firstrow = firstrow + 1
'OpSheet.Cell(firstRow + 1, 1).Range.Text = "T:"
'OpSheet.Cell(firstRow + 1, 2).Range.Text = 50
'OpSheet.Cell(firstRow + 2, 1).Range.Text = "A:"
'OpSheet.Cell(firstRow + 2, 2).Range.Text = 100
' make the last cell be a total
'OpSheet.Cell(firstRow + 3, 2).Select
'MSWord.Selection.InsertFormula Formula:="=SUM(ABOVE)", NumberFormat:="#,##0.00"
' turn on borders of the table
With OpSheet.Borders
.InsideLineStyle = wdLineStyleSingle
.OutsideLineStyle = wdLineStyleDouble
End With
Dim oper As FMOperation, tool As FMToolMap, slot As Long
Dim i As Integer
i = 0
OldTOOL = ""
For Each oper In FMDoc.Operations
If oper.Tool.Name<> OldTOOL Then
For Each tool In FMDoc.ToolMaps
If Not (oper.Tool Is Nothing) Then
If (tool.Tool = oper.Tool) Then
slot=tool.ToolNumber
End If
End If
Next
OpSheet.Cell(firstrow + i, 1 ) = CStr(slot)
OpSheet.Cell(firstrow + i, 2 ) = oper.Tool.Name
OpSheet.Cell(firstrow + i, 3 ) = oper.FeatureName
OpSheet.Cell(firstrow + i, 4 ) = oper.SpeedText
OpSheet.Cell(firstrow + i, 5 ) = oper.FeedText
OpSheet.Cell(firstrow + i, 6 ) = oper.DepthText
OpSheet.Cell(firstrow + i, 7 ) = oper.Tool.Holder
OldTOOL = oper.Tool.Name
i = i + 1
End If
Next
End Sub
' Add a toolbar and buttons upon loading of this addin into FeatureCAM.
'
Private Sub AddIn_OnConnect(ByVal flags As FeatureCAM.tagFMAddInFlags)
' Bar name Button name Button face ID
MakeButtonAndBar "Utilities", "Werkzeugliste", 42
End Sub
'
' remove button or hide toolbar if add-in deselected
'
Private Sub AddIn_OnDisConnect(ByVal flags As FeatureCAM.tagFMAddInFlags)
HideDeleteBarButton "Utilities", "Werkzeugliste"
End Sub
Private Sub MakeButtonAndBar(ByVal bar_name As String, ByVal button_name As String, _
ByVal button_id As Integer)
Dim bars As FMCmdBars, bar As FMCmdBar, ctrl As FMCmdBarBtn
Set bars = Application.CommandBars
Set bar = bars(bar_name)
If bar Is Nothing Then
Set bar = bars.Add(bar_name)
Else
bar.Visible = True
End If
Set ctrl = bar.Controls(button_name)
If ctrl Is Nothing Then
Set ctrl = bar.Controls.Add( ,,button_name)
ctrl.FaceId = button_id
bar.Visible = True
End If
End Sub
Private Sub HideDeleteBarButton(ByVal bar_name As String, ByVal button_name As String)
Dim bars As FMCmdBars, bar As FMCmdBar, ctrl As FMCmdBarCtrl
Set bars = Application.CommandBars
Set bar = bars(bar_name)
If Not bar Is Nothing Then
Set ctrl = bar.Controls(button_name)
If Not ctrl Is Nothing Then
If bar.Controls.Count > 1 Then
ctrl.Delete
Else
bar.Visible=False
End If
End If
End If
End Sub