My 2 cents worth works every time in every version with one caveat
you must find and register "pcdmisutils.dll" first
for 32 bit OS's register using regsvr32
for 64 bit it must be placed in the "WOW" directory under windows and regsvr32 executed with admin privileges (cntrl - shift - enter)
a sample application which brings in our automated PCDMIS TO EXCEL>>>
Sub MAIN
Dim App As Object
Set App = CreateObject("PCDLRN.Application")
Dim Part As Object '<<<<<<<<<<<<<<<
Set Part = App.ActivePartProgram '<<<<<<<<<<<<<
Dim Cmds As Object
Set Cmds = Part.Commands
Dim Cmd As Object
Dim DCmd As Object
Dim DcmdID As Object
Dim DimID As String
Dim THISFILE As String
Dim SOURCE As String
Dim DEST As String
On Error GoTo NOCOPY
SOURCE = "C:\QTI\MASTER.xls"
DEST = "C:\QTI\" & PART.PARTNAME & ".XLS"
FILECOPY SOURCE, DEST
NOCOPY:
THISFILE = PART.PARTNAME & ".XLS"
Dim oxl As Object
Dim lsSheetName As String
Dim lbReopenBetweenRuns As Boolean
' Set lbReopenBetweenRuns = False If you want the worksheet To stay Open between runs
lbReopenBetweenRuns = False
'If excel isnt running, we dont want the Next Line To cras
'Get a handle To the running instance of excel
Dim oExcelBroker As Object
Set oExcelBroker = CreateObject("PCDMISUTILS.cExcelBroker")
Set oxl = oExcelBroker.GetExcel()
Set oExcelBroker = Nothing
'Turn off Error checking
On Error Resume Next
' make sure If the workbook is Open we Close it before we try To reopen it
lsSheetName = ""
lsSheetName = oxl.Workbooks(THISFILE).Name
If lbReopenBetweenRuns Then
If lsSheetName <> "" Then
' Workbook is currently Open -- Close it w/o saving changes
oxl.Workbooks(THISFILE).Close False
End If
' Resume the normal Error handling
'On Error GoTo 0
' Open the workbook containing the macro we want To run
oxl.Workbooks.Open DEST, 3, False
Else
'keep the workbook Open between runs
If lsSheetName <> "" Then
'If we're supposed To keep the workbook Open And treat it As an additional run
'make sure this is the activ workbook
oxl.Workbooks(THISFILE).Activate
Else
' Resume the normal Error handling
On Error GoTo 0
' Open the workbook containing the macro we want To run
oxl.Workbooks.Open DEST, 3, False
End If
End If
On Error Resume Next
' Run the main macro
lsSheetName = oxl.ActiveWorkbook.Name
oxl.Run lsSheetName & "!Sheet1.main"
'Remove the ' In the begining of the Next Line To enable autosaving the sheet
oxl.ActiveWorkbook.Save
'Show excel To the user
oxl.Visible = True
'cleanup
Set oxl = Nothing
End Sub
anyone who wants the excel spreadsheet to review and comment please pm me... it is IMHO the best interface out there for pcdmis
After i have developed it since the first version of pcdmis after growing up with AVAIL
WE ALSO HAVE MANY OTHER FIRST ARTICLE TEMPLATES ALL FOR FREE AND BETA REVIEW
My 2 cents worth works every time in every version with one caveat
you must find and register "pcdmisutils.dll" first
for 32 bit OS's register using regsvr32
for 64 bit it must be placed in the "WOW" directory under windows and regsvr32 executed with admin privileges (cntrl - shift - enter)
a sample application which brings in our automated PCDMIS TO EXCEL>>>
Sub MAIN
Dim App As Object
Set App = CreateObject("PCDLRN.Application")
Dim Part As Object '<<<<<<<<<<<<<<<
Set Part = App.ActivePartProgram '<<<<<<<<<<<<<
Dim Cmds As Object
Set Cmds = Part.Commands
Dim Cmd As Object
Dim DCmd As Object
Dim DcmdID As Object
Dim DimID As String
Dim THISFILE As String
Dim SOURCE As String
Dim DEST As String
On Error GoTo NOCOPY
SOURCE = "C:\QTI\MASTER.xls"
DEST = "C:\QTI\" & PART.PARTNAME & ".XLS"
FILECOPY SOURCE, DEST
NOCOPY:
THISFILE = PART.PARTNAME & ".XLS"
Dim oxl As Object
Dim lsSheetName As String
Dim lbReopenBetweenRuns As Boolean
' Set lbReopenBetweenRuns = False If you want the worksheet To stay Open between runs
lbReopenBetweenRuns = False
'If excel isnt running, we dont want the Next Line To cras
'Get a handle To the running instance of excel
Dim oExcelBroker As Object
Set oExcelBroker = CreateObject("PCDMISUTILS.cExcelBroker")
Set oxl = oExcelBroker.GetExcel()
Set oExcelBroker = Nothing
'Turn off Error checking
On Error Resume Next
' make sure If the workbook is Open we Close it before we try To reopen it
lsSheetName = ""
lsSheetName = oxl.Workbooks(THISFILE).Name
If lbReopenBetweenRuns Then
If lsSheetName <> "" Then
' Workbook is currently Open -- Close it w/o saving changes
oxl.Workbooks(THISFILE).Close False
End If
' Resume the normal Error handling
'On Error GoTo 0
' Open the workbook containing the macro we want To run
oxl.Workbooks.Open DEST, 3, False
Else
'keep the workbook Open between runs
If lsSheetName <> "" Then
'If we're supposed To keep the workbook Open And treat it As an additional run
'make sure this is the activ workbook
oxl.Workbooks(THISFILE).Activate
Else
' Resume the normal Error handling
On Error GoTo 0
' Open the workbook containing the macro we want To run
oxl.Workbooks.Open DEST, 3, False
End If
End If
On Error Resume Next
' Run the main macro
lsSheetName = oxl.ActiveWorkbook.Name
oxl.Run lsSheetName & "!Sheet1.main"
'Remove the ' In the begining of the Next Line To enable autosaving the sheet
oxl.ActiveWorkbook.Save
'Show excel To the user
oxl.Visible = True
'cleanup
Set oxl = Nothing
End Sub
anyone who wants the excel spreadsheet to review and comment please pm me... it is IMHO the best interface out there for pcdmis
After i have developed it since the first version of pcdmis after growing up with AVAIL
WE ALSO HAVE MANY OTHER FIRST ARTICLE TEMPLATES ALL FOR FREE AND BETA REVIEW