Insert table macro

I'm trying to write a macro that will insert a general tableinto a drawing. it works great, but I want it to point to a certaintable.

Does anyone know the code to do this?
This is what I got so far.

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
swApp.ActiveDoc.ActiveView.FrameState = 1
Dim genTable As Object
Set genTable = Part.InsertTableAnnotation(0.01589136281956,0.2698647964003, 3, 3, 8)
If Not genTable Is Nothing Then
genTable.BorderLineWeight = 0
genTable.GridLineWeight = 0
End If
Part.ClearSelection2 True
End SubSolidworksApi macros
Comments 6
SF
SF 2007-01-24
Rob,

What do you mean by "point to a certain table"?

SA
RJ
RJ 2007-01-24
I have a template that i already created and saved to anetwork location. I want the macro to insert that table into thedrawing and not create a new general table. (which it does now.)
SF
SF 2007-01-25
Rob,

What you want to do is copy the table from one drawing to anotherdrawing? To do that, you would have to open the drawing with thetable you want to copy, select it, copy it, open the drawing youwant to copy to then paste it. Right now I cannot think of a cleanway to do that. I will have to give it some thought. You wouldprobably have to have both drawings open.

SA
RJ
RJ 2007-01-25
I got it...

I needed to add the path of the general table to the macro.
Now, I just hit F4 and my table is inserted in the location i want.

Thanks for the help...
SF
SF 2007-06-29
Rob, can you add your code to this posting? I'm also tryingto adda general table via a macro.

Thanks!
CM
CM 2008-05-06
I am trying to do this also using an existing template(.sldtbt) file.

Here is what I have, it doesn't work.

Dim swApp As Object
Dim Part As Object
Dim SelMgr As Object
Dim boolStatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim Feature As Object

Sub main()

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
swApp.ActiveDoc.ActiveView.FrameState = 1
Dim genTable As Object
Set genTable = Part.InsertTableAnnotation2(False, 0, 0, , 3,"V:\SolidWorks\General Table Templates\MISC_ENG_ACCT_TABLE.sldtbt")
If Not genTable Is Nothing Then
genTable.BorderLineWeight = 0
genTable.GridLineWeight = 0
End If
Part.ClearSelection2 True
End Sub


Any ideas?