×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Export to excel journal

Export to excel journal

Export to excel journal

(OP)
Hi guys,
I'm searching for journal solution to export columns from Assembly Navigator to Excel. I want to have this in one button.

I was trying this, but this don't want to work
    Public excelApp As Excel.Application
    Public excelBook As Excel.Workbook
    Public excelSheet As Excel.Worksheet

Any help? Direction? Solution?

NX 6 and Excel 2007

RE: Export to excel journal

Right click on the up/down arrow in the ANT, flyout:send to spreadsheet?

RE: Export to excel journal

(OP)
I know I can do like that, but I want to do this by journal.

RE: Export to excel journal

To use commands like

 Public excelApp As Excel.Application
 Public excelBook As Excel.Workbook
 Public excelSheet As Excel.Worksheet

you need

Imports Microsoft.Office.Interop

now Microsoft.Office.Interop is not a library supported by journalling.  Therefore to use the above commands you need to build it as a dll.

Regards

Frank Swinkels

RE: Export to excel journal

(OP)
Hi guys,
my code get err in line 3 with spreadsheet_name

CODE --> .Net

Dim ufs As UFSession = UFSession.GetUFSession() Dim spreadsheet_name As String ufs.XS.ExtractSpreadsheet(spreadsheet_name, "C:\test.xlsx")

from NXOPEN .Net Api

int UF_XS_extract_spreadsheet
(

char * spreadsheet_name,
char * file_name

)

char * spreadsheet_name Input Spreadsheet object name:
"MODELING_SHEET" - modeling spreadsheet data
"DEFAULT_SHEET" - Gateway spreadsheet data
"PART_FAMILY_SHEET" - Part Family spreadsheet data

How to define "char * spreadsheet_name"? Or how to get object MODELING_SHEET?
Any help?

RE: Export to excel journal

You can access Excel as per the following code, but you lose the 'autocomplete' feature of visual studio. If you go this route, you may want to keep an instance of Excel running so you can reference the object model.

The following code was tested on NX 7.5 and Excel 2010.

CODE

Option Strict Off Imports System Imports NXOpen Module Module1 Sub Main() Dim theSession As Session = Session.GetSession() Dim objExcel = CreateObject("Excel.Application") If objExcel Is Nothing Then MsgBox("Could not start Excel, this journal will now exit.", MsgBoxStyle.Critical, "Error") Exit Sub End If Dim excelFile As String = "C:\temp\test.xlsx" If Not IO.File.Exists(excelFile) Then MsgBox("Specified file not found, journal will now exit.", MsgBoxStyle.Critical, "File not found.") Exit Sub End If Dim objWorkbook = objExcel.Workbooks.Open(excelFile) If objWorkbook Is Nothing Then MsgBox("Could not open Excel file, journal will now exit.", MsgBoxStyle.Critical, "Error") Exit Sub End If objExcel.visible = True objExcel.cells(1, 1).value = "your text here" objWorkbook.save() 'to close the workbook and excel, uncomment the following lines 'objWorkbook.close() 'objExcel.quit() 'objWorkbook = Nothing 'objExcel = Nothing MsgBox("Journal execution successful", MsgBoxStyle.Information, "Success") End Sub Public Function GetUnloadOption(ByVal dummy As String) As Integer 'Unloads the image when the NX session terminates GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination End Function End Module

www.nxjournaling.com

RE: Export to excel journal

(OP)
I'm trying to make journal to export spreadsheet to Excel (Right mouse button in Assembly Navigator and then export to spreadsheet). With journal I want to make some corrections in spreadsheet and then save the spreadsheet file, close excel and come back to NX.
I made something similar, I could export txt file with Plist.ListToFile function.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources