ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
JDJames Dickson28/01/2019

The code below worked great in Solidworks 2016 (I could adjust the Grid-line and Borderline Weight). In 2019 it still inserts the table I need but inserts the Borderline Weight thick and shows no Grid-lines.

Can someone help me out? I need to be able to chance the Grid-line and Borderline Weights when inserted. Thanks in advance for any help you might be able to give.

Option Explicit

Dim swApp As SldWorks.SldWorks

Dim swModel As SldWorks.ModelDoc2

Dim swDrawing As SldWorks.DrawingDoc

Dim swTable As SldWorks.TableAnnotation

Dim GetUserName As String

Const sTablePath As String = "D:\SolidWorks\Tables\GT.sldtbt"

Sub main()

Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc

GetUserName = Environ$("username")

If (swModel Is Nothing) Or (swModel.GetType <> swDocDRAWING) Then

swApp.SendMsgToUser ("To be used for drawings only, Open a drawing first and then TRY!")

Exit Sub

End If

Set swDrawing = swModel

' Insert general table

Set swTable = swDrawing.InsertTableAnnotation2(False, 1.17982409743605E-02, 1.71811613648901E-02, swBOMConfigurationAnchor_TopLeft, "C:\Users\" & GetUserName & "General Table Location", 3, 1)

If Not swTable Is Nothing Then

swTable.BorderLineWeight = 0

swTable.GridLineWeight = 0

End If

End Sub