Open excel file after it has been exported

Started by jason25, April 14, 2011, 02:27:08 AM

Previous topic - Next topic

jason25

Hello,

I am fairly new to Polyworks let aside creating macros, I have stumbled my way through creating several though to streamline our machine ground alignment process though.  What I have done is created a macro that will report some features and export them to excel.  I have only seen 2 ways to export to excel:
Option 1 - FILE EXPORT_REPORT EXCEL_ONE_ITEM_PER_PAGE (,,) - opens the excel report but user must save from excel
Option 2 - FILE EXPORT_REPORT EXCEL_FILE_ONE_PAGE ( ,,, ) - allows me to save using the macro but does not automatically open excel unless excel was already open.  We would like the user to save the report so this is the preferred method as the file is created and saved using a macro.

here is the macro that I have:

version "4.0"
##########################################################################
# CREATED: BY Jason
# VERSION: V11.0.28

# GOAL: Exports an Excel report after you enter your name and report file name.
##########################################################################

DECLARE vName
DECLARE vReportName
DECLARE vTitle "Report Author"
DECLARE vTitle2 "Report Name"

INPUT STRING (vName, $vTitle, "Enter your name.")
# Loops until a name is entered
WHILE $vName ==  ""
    INPUT STRING (vName, $vTitle, "Enter your name.")
ENDWHILE

INPUT STRING (vReportName, $vTitle2, "Specify a file name for your report.")
# Loops until a Report name is entered
WHILE $vReportName ==  ""
    INPUT STRING (vReportName, $vTitle2, "Specify a file name for your report.")
ENDWHILE

# Deletes previous report items
TREEVIEW SELECT NONE
TREEVIEW REPORT_ITEM SELECT ALL
EDIT OBJECT DELETE ( )   

# Selects Header making it available for modification.
TREEVIEW SELECT NONE
TREEVIEW REPORT_ITEM SELECT ( 1, "On" )

# Sets Header Information
TREEVIEW REPORT_ITEM HEADER PROPERTIES REPORT_AUTHOR ( "$vName", )
TREEVIEW REPORT_ITEM HEADER PROPERTIES REPORT_TITLE ( "$vReportName", )
TREEVIEW REPORT_ITEM HEADER PROPERTIES WORKSPACE_NAME ( "On", )
TREEVIEW REPORT_ITEM HEADER PROPERTIES PROJECT_NAME ( "On", )
TREEVIEW REPORT_ITEM HEADER PROPERTIES DATE ( "On", )
TREEVIEW REPORT_ITEM HEADER PROPERTIES TIME ( "On", )

# Selects all Features to report from WCS.
TREEVIEW SELECT NONE
ALIGN COORDINATE_SYSTEM ACTIVE ( "World" )
TREEVIEW SELECT NONE
TREEVIEW FEATURE SELECT RANGE ( 1, 11, "On" )
REPORT_ITEM TABLE FROM_SELECTED_FEATURES_ONE_TABLE ( )

# Activates Part Axis 2 and selects all Features to report from this 2nd Coordinate System.
ALIGN COORDINATE_SYSTEM ACTIVE ( "Part Axis 2" )
TREEVIEW SELECT NONE
TREEVIEW FEATURE SELECT RANGE ( 12, 35, "On" )
REPORT_ITEM TABLE FROM_SELECTED_FEATURES_ONE_TABLE ( )

# Exports Report to Excel, must be manually opened.
TREEVIEW SELECT NONE
TREEVIEW REPORT_ITEM SELECT ALL
FILE EXPORT_REPORT EXCEL_FILE_ONE_PAGE ( "I:\Maintenance\Proactive Maintenance\Ground Alignments\$vReportName.xls", 1,, )

MACRO PAUSE ("Report Completed","Your report has been created.")

jason25

Solution:

DOS prompts must be used in order for this to happen:

SYSTEM ("START EXCEL.EXE ${_QUOTES}Insert path to file here${_QUOTES}")