Yes there is! Just keep in mind you need to change the .CustomInfo("") to your custom parameter name, the attached code should do exactly what you want! You need to go to References and add the Microsoft Excel Object Type Library for the excel functionality to work.
Dim swApp As SldWorks.SldWorks
Dim swModel As ModelDoc2
Dim PartNum, DateCreated As String
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set swApp = New SldWorks.SldWorks
Set swModel = swApp.ActiveDoc
Debug.Print("******** Time Stamp: " & Date.Today & " ************")
PartNum = swModel.CustomInfo("Enter your Custom parameter Here")
DateCreated = swModel.SummaryInfo(swSummInfoField_e.swSumInfoCreateDate)
Debug.Print("Part Number: " & PartNum)
Debug.Print("Date Created: " & DateCreated)
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add()
Set xlSheet = xlBook.Worksheets(1) 'First worksheet in workbook
.Cells(1, 1).value = "Instance"
.Cells(1, 2).value = "Part Number"
.Cells(1, 3).value = "Date Created"
For i = 2 To 11
.Cells(i, 1).value = i
.Cells(2, 2).value = PartNum
.Cells(2, 3).value = DateCreated
xlApp.Visible = True
I really appreciate your reply. I learned from it, however it is not quite what I am looking for. I want to retrieve a drawing field value that is on the sheet. For example, the title of the drawing is driven from the view specified in the sheet properties. Is there a way access drawing fields on sheets rather than sheet custom properties?
Chris, I'm not sure I follow you on where this variable comes from.. Can you post an example?
Mike the variable comes from the part configuration specific properties. When I set up my drawing template I set the drawing title and part number to populate based on the part properties in a selected view.
Thanks Deepak for the two examples.
I understand how to assign note identities to fields in the title block (done automatically); however, I am not sure how to assign a name to an annotation that you put on your drawing. How do you assign a name to an annotation on the drawing sheet? Thanks.
I found that using notes within a titleblock is highly efficient. I can also use configuration specific properties from parts in specific views on the sheet to automatically populate the values. This takes me out the business of manually creating excel spreadsheets to manage the drawings for specific projects. Thanks.