' ******************************************************************************
' D:\TEMP\swx263\Macro1.swb - macro recorded on 01/11/02 by HSENSCHWAR
' ******************************************************************************
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long
Dim Annotation As Object
Dim Gtol As Object
Dim DatumTag As Object
Dim FeatureData As Object
Dim Feature As Object
Dim Component As Object
Dim CustInfo As Variant
Dim string1 As String
Dim retval As Variant
Dim numcust As Integer
Dim TempString As String
Dim Template As Object
Dim Errorss As Long
Dim TemplateTitle As String
Dim InfoType As Variant
Dim InfoContents As String
Sub main()
Set swApp = CreateObject("SldWorks.Application"

Set Part = swApp.ActiveDoc
string1 = "Ready to COPY CUSTOM INFO from file "
retval = swApp.SendMsgToUser2(string1, swMbInformation, swMbYesNo)
TempString = swApp.GetUserPreferenceStringValue(swDefaultTemplatePart)
retval = swApp.SendMsgToUser2(string1 + TempString, swMbInformation, swMbYesNo)
retval = swApp.SendMsgToUser2(TempString, swMbInformation, swMbOk)
If retval = swmbhitno Then End
Set Template = swApp.NewPart
TemplateTitle = Template.gettitle
CustInfo = Template.GetCustomInfoNames2(""

numcust = UBound(CustInfo)
retval = swApp.SendMsgToUser2(Str(LBound(CustInfo)) + " to " + Str(UBound(CustInfo)), swMbInformation, swMbOk)
For i = 0 To numcust
InfoType = Template.GetCustomInfoType3("", CustInfo(i))
InfoContents = Template.CustomInfo2("", CustInfo(i))
retval = Part.AddCustomInfo3("", CustInfo(i), InfoType, InfoContents)
Next i
swApp.QuitDoc (TemplateTitle)
retval = swApp.SendMsgToUser2("Finito!", swMbInformation, swMbOk)
End Sub