I'm trying to use this method to create and rename copies of files. I keep getting the error "The operation was cancelled by user". The API help say that this means the operation was cancelled via the option callback interface. Again according to the help file the callback is not optional. I've implemented the IEdmCallback6 in my code and have all the implemented sub and functions defined as below. Has anyone used this folder method before? I don't really want it to prompt the user in anyway. I just want it to execute.
Private Function IEdmCallback6_MsgBox(ByVal lParentWnd As Long, ByVal lMsgID As Long, ByVal bsMsg As String, Optional ByVal eType As EdmLib.EdmMBoxType = 0&) As EdmLib.EdmMBoxResult IEdmCallback6_MsgBox = Nothing End Function Private Sub IEdmCallback6_Resolve(ByVal lParentWnd As Long, ByVal ppoItems() As EdmLib.EdmCmdData) End Sub Private Function IEdmCallback6_SetProgress(ByVal lBarIndex As Long, ByVal lPos As Long, ByVal bsMsg As String) As Boolean IEdmCallback6_SetProgress = True End Function Private Sub IEdmCallback6_SetProgressRange(ByVal lBarIndex As Long, ByVal lMax As Long) End Sub Private Sub IEdmCallback6_SetStatusMessage(ByVal lBarIndex As Long, ByVal bsMessage As String) End Sub
The line to call the AddFiles is as follows.
NewProjectFolderObj.AddFiles(1, files,
where
Dim files() As EdmAddFileInfoReDim
files(0)
.....loop through xml file to read files to copy.
files(files.Count - 1).mbsNewName = newname
files(files.Count - 1).mbsPath = TemplateFolder.LocalPath &
"\\"
files(files.Count - 1).mlSrcDocumentID = EPDMFile_to_copyResults.ID
files(files.Count - 1).mlSrcProjectID = EPDMFile_to_copyResults.ParentFolderID
files(files.Count - 1).mlEdmAddFlags =
EdmAddFlag.EdmAdd_Simple & EdmAddFlag .EdmAdd_UniqueVarClearDuplicate
Is there something I'm missing?
Thanks
Frank Pampreen
Munters
SolidworksApi macros