This blog is the third part of a 3 part series on NX journalling

The aim of this blog post is to open an excel window from NX and exporting properties from workPart.Dimensions to excel.

Continuing from the previous post, we could write the following program

The following code can also be found at

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpenUI

Module Module1

Sub Main()

Dim theSession As Session = Session.GetSession()
Dim theUISession As UI = UI.GetUI

Dim workPart As Part = theSession.Parts.Work

Dim lw As ListingWindow = theSession.ListingWindow
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, “journal”)

‘change excelFileName to meet your needs
Const excelFileName As String = “E:\Book1.xlsm”
Dim row As Long = 1
Dim column As Long = 1

‘create Excel object
Dim objExcel = CreateObject(“Excel.Application”)
If objExcel Is Nothing Then
theUISession.NXMessageBox.Show(“Error”, NXMessageBox.DialogType.Error, “Could not start Excel, journal exiting”)
theSession.UndoToMark(markId1, “journal”)
Exit Sub

End If

‘open Excel file
Dim objWorkbook = objExcel.Workbooks.Open(excelFileName)
If objWorkbook Is Nothing Then
theUISession.NXMessageBox.Show(“Error”, NXMessageBox.DialogType.Error, “Could not open Excel file: ” & excelFileName &                                                                                        ControlChars.NewLine & “journal exiting.”)
theSession.UndoToMark(markId1, “journal”)
Exit Sub
End If

objExcel.visible = True

objExcel.Cells(row, 1) = workPart.FullPath

For Each myDimension As Annotations.Dimension In workPart.Dimensions
row += 1
myDimension.GetDimensionText(myDimText, myDimDualText)
objExcel.Cells(row, column) = myDimension.GetType.ToString
objExcel.Cells(row, column+1) = myDimText(0)

objWorkbook = Nothing
objExcel = Nothing

End Sub

12 Replies to “Exporting dimensions to Excel from NX”

  1. I not to mention my guys were following the good techniques on your web blog and before long got an awful suspicion I had not expressed respect to the website owner for those strategies. These boys were definitely passionate to see them and now have extremely been using these things. Thank you for getting very thoughtful as well as for having this kind of ideal useful guides most people are really wanting to be aware of. Our own honest apologies for not expressing appreciation to earlier.

  2. My spouse and i have been very fulfilled that Emmanuel managed to finish up his web research out of the precious recommendations he received from your own weblog. It is now and again perplexing to just always be freely giving facts men and women might have been trying to sell. And we know we have got the blog owner to be grateful to for that. The entire illustrations you’ve made, the simple site navigation, the relationships you make it easier to promote – it’s mostly fantastic, and it is letting our son and the family recognize that this issue is enjoyable, and that’s highly important. Thanks for the whole lot!

  3. I’m writing to let you know what a notable experience my friend’s child had reading through the blog. She even learned many pieces, which include what it is like to possess an amazing helping character to make men and women without problems gain knowledge of various hard to do subject matter. You undoubtedly did more than visitors’ expectations. Many thanks for churning out the invaluable, healthy, informative and also easy thoughts on the topic to Evelyn.

  4. I wanted to write you a little bit of observation to thank you very much again with your splendid tips you’ve featured in this case. This is so tremendously generous of people like you to present without restraint what many people could have made available as an e book in order to make some money for their own end, primarily seeing that you could possibly have done it if you ever decided. Those suggestions in addition served like the great way to understand that some people have the same desire the same as mine to learn very much more on the topic of this issue. Certainly there are numerous more pleasurable instances ahead for those who go through your blog.

  5. I would like to express my appreciation to this writer just for bailing me out of this incident. Just after browsing throughout the the web and obtaining notions that were not pleasant, I figured my entire life was done. Existing without the solutions to the problems you’ve fixed by way of your entire article content is a critical case, as well as ones which could have in a negative way affected my entire career if I hadn’t discovered your blog post. Your main capability and kindness in maneuvering every aspect was excellent. I don’t know what I would’ve done if I hadn’t encountered such a stuff like this. I can also at this moment look ahead to my future. Thank you very much for this impressive and results-oriented help. I won’t hesitate to recommend your site to anyone who should receive assistance about this subject matter.

  6. I would like to show some appreciation to you for bailing me out of this particular incident. Just after surfing throughout the world-wide-web and obtaining concepts which are not helpful, I assumed my entire life was done. Existing minus the approaches to the problems you’ve fixed by means of this post is a serious case, and those which could have badly damaged my entire career if I had not discovered the website. Your primary understanding and kindness in maneuvering all the pieces was helpful. I’m not sure what I would have done if I hadn’t encountered such a solution like this. I’m able to at this point relish my future. Thanks very much for the impressive and results-oriented guide. I won’t be reluctant to refer your site to anyone who would need assistance on this issue.

  7. I am only writing to let you understand what a wonderful encounter my wife’s girl enjoyed studying your web page. She came to understand too many issues, including how it is like to have a great teaching heart to get many more quite simply learn about specified problematic topics. You really did more than visitors’ expected results. Many thanks for rendering those helpful, safe, informative not to mention easy thoughts on that topic to Mary.

  8. I intended to create you the very little remark just to give thanks over again for the extraordinary methods you have discussed here. This is shockingly open-handed with you to make easily precisely what a lot of people might have distributed as an electronic book in making some money on their own, especially considering that you could have tried it in the event you considered necessary. The tactics also worked to become great way to fully grasp that someone else have a similar keenness the same as mine to find out a good deal more with respect to this condition. I am sure there are a lot more enjoyable periods in the future for individuals that start reading your website.

  9. I precisely needed to thank you so much all over again. I’m not certain the things that I would have done in the absence of these points contributed by you directly on this subject matter. It truly was the frustrating case in my view, however , noticing a specialized strategy you resolved the issue forced me to weep for happiness. I am just happier for the assistance and sincerely hope you find out what a powerful job your are putting in educating other individuals all through a web site. I am sure you haven’t come across any of us.

Leave a Reply

Your email address will not be published.