Explain exactly what you want macro to do.
You only mentioned taking dimensions from drawing and putting them in excel.
Because that is really simple and I can help you with that.
Just that. So:
Manually, I create a 3D model and dimension it with tolerances. I then create a drawing and dimension it accordingly.
Macro: For each drawing sheet I make, for each dimension, copy dimension (including tolerances-I use limit tolerances), open (specific) excel spreadsheet, paste in column B, row i. repeat for each dimension in the sheet. Ideally it would also recognize geometric tolerances and be able to copy those and paste into Excel.
additional features would be recognizing a string in the drawing table box (i.e drawing number, operation number). I don't know how to locate those variables with a Solidworks Macro, but can work with them once I have the variable in Excel.
Here is the simple macro to traverse dimension in drawing and output the values. If you know Excel API it would be easy for you to change the macro to suit your needs:
Dim swApp As SldWorks.SldWorks
Dim swDraw As SldWorks.DrawingDoc
Dim swView As SldWorks.View
Set swApp = Application.SldWorks
Set swDraw = swApp.ActiveDoc
Set swView = swDraw.GetFirstView
Do While Not swView Is Nothing
Dim vDims As Variant
Dim swDispDim As SldWorks.DisplayDimension
Dim swDim As SldWorks.Dimension
Dim i As Integer
vDims = swView.GetDisplayDimensions
If Not IsEmpty(vDims) Then
For i = 0 To UBound(vDims)
Set swDispDim = vDims(i)
Set swDim = swDispDim.GetDimension
Debug.Print "Dimension to export to Excel: " & swDim.FullName & " = " & swDim.GetSystemValue2("") & " meters"
Set swView = swView.GetNextView
Thanks everyone for your help, much appreciated. Kudos to Josh Brady for writing such a robust program; I think I will be able to easily tweak it for my application.