Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
hldr
in reply to: hldr

Thank you guys! I already gave up, but reading your comments gave me new hope and it's working now! it's something like this now: 

		wb2 = excelApp.Workbooks.Open(MacroExcel)
		xlws2 = wb2.WorkSheets(1)
		
		'get partnumber of main asssembly 
		For Each dwgSheet As Sheet In ThisDrawDoc.Sheets
			If dwgSheet.DrawingViews.Count > 0 Then
				'modelFile = dwgSheet.DrawingViews(1).ReferencedDocumentDescriptor.FullDocumentName
				modelDoc = dwgSheet.DrawingViews(1).ReferencedDocumentDescriptor.ReferencedDocument
				prtNumber = modelDoc.PropertySets("Design Tracking Properties").Item("Part Number").Value
			End If
		Next
                
oLastRow = xlws.UsedRange.Rows.Count
'Column Title xlws2.Range("K1").Value = "Maakartikel:" xlws2.Range("L1").Value = "Batchgrootte:" 'Add assembly name and production amount to parts Dim MaakRange2 As Range = xlws2.Range("K2:K" & oLastRow) MaakRange2.Value = prtNumber Dim BatchRange2 As Range = xlws2.Range("L2:L" & oLastRow) BatchRange2.Value = Production_Amount 'Save Document As Dim FileName As String FileName = "C:\User\Desktop\" & sFileName & ".xlsm" wb2.SaveAs(FileName) wb2.Close 'excelApp.Quit 'excelApp = Nothing excelApp.Application.Quit