diff --git a/Project/.gitignore b/Project/.gitignore new file mode 100644 index 0000000..608a9b8 --- /dev/null +++ b/Project/.gitignore @@ -0,0 +1,2 @@ +*.xlsm +*.xls diff --git a/Project/VBAToolKit_DEV.xlsm b/Project/VBAToolKit_DEV.xlsm deleted file mode 100644 index 990643e..0000000 Binary files a/Project/VBAToolKit_DEV.xlsm and /dev/null differ diff --git a/Source/ConfProd/vtkConfigurationManagerExcel.cls b/Source/ConfProd/vtkConfigurationManagerExcel.cls index dd83458..bb5a60f 100644 --- a/Source/ConfProd/vtkConfigurationManagerExcel.cls +++ b/Source/ConfProd/vtkConfigurationManagerExcel.cls @@ -928,14 +928,14 @@ Public Sub duplicate(Wb As Workbook, cm As vtkConfigurationManager) ' init projectName and rootPath from cm m_projectName = cm.projectName m_rootPath = cm.rootPath - ' call initReferences with the references from cm - Me.initReferences cm.references ' create all configuration from cm For i = 1 To cm.configurationCount Me.addConfiguration configuration:=cm.configuration(i), path:=cm.getConfigurationPathWithNumber(i), _ template:=cm.getConfigurationTemplateWithNumber(i), projectName:=cm.getConfigurationProjectNameWithNumber(i), _ comment:=cm.getConfigurationCommentWithNumber(i) Next i + ' call initReferences with the references from cm + Me.initReferences cm.references ' create all modules from cm For i = 1 To cm.moduleCount Me.addModule module:=cm.module(i) @@ -948,10 +948,10 @@ Public Sub duplicate(Wb As Workbook, cm As vtkConfigurationManager) Next i ' init reference usage for each configuration For i = 1 To cm.configurationCount - Set refs = cm.references + Set refs = cm.getConfigurationReferencesWithNumber(i) For j = 1 To refs.Count Set ref = refs(j) - refn = CInt(Right(ref.id, Length(ref.id) - 1)) + refn = CInt(Right(ref.id, Len(ref.id) - 1)) referenceManager.setReferenceWihNumber True, refn, i Next j Next i diff --git a/Source/ConfProd/vtkGitFunctions.bas b/Source/ConfProd/vtkGitFunctions.bas index 3fd972c..f86a01e 100644 --- a/Source/ConfProd/vtkGitFunctions.bas +++ b/Source/ConfProd/vtkGitFunctions.bas @@ -121,6 +121,9 @@ Public Function vtkInitializeGit(folderPath As String, Optional logFile As Strin contentStream.WriteLine contentStream.WriteLine "# Ignore the delivery Excel files" contentStream.WriteLine "/Delivery/*.xl*" + contentStream.WriteLine + contentStream.WriteLine "# Ignore the Project Excel files" + contentStream.WriteLine "/Project/*.xl*" contentStream.Close ' Adds all the files in the folder tree to the git repository diff --git a/Source/ConfProd/vtkProjectCreationUtilities.bas b/Source/ConfProd/vtkProjectCreationUtilities.bas index f8e81d9..1026224 100644 --- a/Source/ConfProd/vtkProjectCreationUtilities.bas +++ b/Source/ConfProd/vtkProjectCreationUtilities.bas @@ -113,6 +113,7 @@ Public Sub vtkAddBeforeSaveHandlerInDEVWorkbook(Wb As Workbook, projectName As S Dim handlerString As String handlerString = _ "Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)" & vbNewLine & _ + " On error goto M_Error" & vbNewLine & _ " " & wbVTKName & ".vtkExportConfiguration projectWithModules:=ThisWorkbook.VBProject, projectName:=" & """" & projectName & """" & _ " , confName:=" & """" & confName & """" & _ " , onlyModified:=True" & _ @@ -120,6 +121,7 @@ Public Sub vtkAddBeforeSaveHandlerInDEVWorkbook(Wb As Workbook, projectName As S vbNewLine & _ " " & wbVTKName & ".vtkExportConfigurationsAsXML projectName:=""" & projectName & """, filePath:=" & _ wbVTKName & ".vtkPathOfCurrentProject(ThisWorkbook) & ""\"" & " & wbVTKName & ".vtkProjectForName(""" & projectName & """).XMLConfigurationStandardRelativePath" & vbNewLine & _ + "M_Error:" & vbNewLine & _ "End Sub" & vbNewLine With Wb.VBProject.VBComponents("ThisWorkbook").CodeModule diff --git a/Source/ConfTest/ThisWorkbook.cls b/Source/ConfTest/ThisWorkbook.cls index 88799b2..ee7b48a 100644 --- a/Source/ConfTest/ThisWorkbook.cls +++ b/Source/ConfTest/ThisWorkbook.cls @@ -44,12 +44,16 @@ Private Sub Workbook_AddinUninstall() End Sub Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) + ' If error Exit silently + On Error GoTo M_Error + ' Export and normalize modules VBAToolKit.vtkExportConfiguration ThisWorkbook.VBProject, "VBAToolKit", "VBAToolKit_DEV", onlyModified:=True ' Export as XML VBAToolKit.vtkExportConfigurationsAsXML projectName:="VBAToolKit", filePath:=VBAToolKit.vtkPathOfCurrentProject(ThisWorkbook) & "\" & VBAToolKit.vtkProjectForName("VBAToolKit").XMLConfigurationStandardRelativePath +M_Error: End Sub