Skip to content

Commit

Permalink
minor changes for run-add-in-proc feature
Browse files Browse the repository at this point in the history
  • Loading branch information
josef-poetzl committed May 11, 2024
1 parent f8a1870 commit 7fc0e27
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 22 deletions.
45 changes: 27 additions & 18 deletions Version Control.accda.src/modules/clsVersionControl.cls
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,13 @@ End Sub
' Purpose : Export the source code for the current database
'---------------------------------------------------------------------------------------
'
Public Sub Export()
If HasFormOpen Then Exit Sub
RunExport ecfAllObjects
End Sub
Public Function Export() As eErrorLevel
If HasFormOpen Then
Export = eelCritical
Exit Function
End If
Export = RunExport(ecfAllObjects)
End Function


'---------------------------------------------------------------------------------------
Expand All @@ -66,10 +69,13 @@ End Sub
' Purpose : Export just the VBA related components
'---------------------------------------------------------------------------------------
'
Public Sub ExportVBA()
If HasFormOpen Then Exit Sub
RunExport ecfVBAItems
End Sub
Public Function ExportVBA() As eErrorLevel
If HasFormOpen Then
ExportVBA = eelCritical
Exit Function
End If
ExportVBA = RunExport(ecfVBAItems)
End Function


'---------------------------------------------------------------------------------------
Expand All @@ -79,24 +85,27 @@ End Sub
' Purpose : Export the selected object
'---------------------------------------------------------------------------------------
'
Public Sub ExportSelected()
Public Function ExportSelected() As eErrorLevel

Dim objSelected As AccessObject

If HasFormOpen Then Exit Sub
If HasFormOpen Then
ExportSelected = eelCritical
Exit Function
End If

Set objSelected = GetSelectedNavPaneObject
If objSelected Is Nothing Then
ExportSelected = eelCritical
MsgBox2 "Please Select an Object First", _
"Select a single object in the Navigation Pane to export.", _
"(This item must have the keyboard focus.)", vbInformation
ExportSelected = eelCritical
Else
' Export the item
ExportSelected = RunExport(, objSelected)
End If

End Sub
End Function


'---------------------------------------------------------------------------------------
Expand All @@ -106,7 +115,8 @@ End Sub
' Purpose : Handle different kinds of exports based on filter
'---------------------------------------------------------------------------------------
'
Private Function RunExport(Optional intFilter As eContainerFilter = ecfAllObjects, Optional objItem As AccessObject) As eErrorLevel
Private Function RunExport(Optional intFilter As eContainerFilter = ecfAllObjects, _
Optional objItem As AccessObject) As eErrorLevel

Dim ExportErrorLevel As eErrorLevel

Expand All @@ -133,7 +143,6 @@ Private Function RunExport(Optional intFilter As eContainerFilter = ecfAllObject

End Function


'---------------------------------------------------------------------------------------
' Procedure : Build
' Author : Adam Waller
Expand Down Expand Up @@ -523,9 +532,9 @@ Private Sub SaveState()

' Error trapping setting. (We need this to "Break in Class Modules" for this add-in)
strValue = Application.GetOption("Error Trapping")
If strValue <> "2" Then
If strValue < "1" Then
PreserveSetting "Error Trapping", strValue
Application.SetOption "Error Trapping", 2
Application.SetOption "Error Trapping", 1
End If

End Sub
Expand Down Expand Up @@ -646,9 +655,9 @@ Private Function HasFormOpen(Optional blnWarnUser As Boolean = True) As Boolean
End If
MsgBox2 "Add-in Form Already Open", _
"Please close '" & strCaption & "' before running this action.", , vbInformation
HasFormOpen = True
Exit Function
End If
HasFormOpen = True
Exit Function
End If
End If
Next
Expand Down
7 changes: 4 additions & 3 deletions Version Control.accda.src/modules/modImportExport.bas
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,11 @@ Private Function TryRunAddInProcedure(ByVal ProcedureName As String) As Boolean

If DebugMode(True) Then On Error GoTo 0 Else On Error GoTo ErrHandler

ProcedureName = Replace(ProcedureName, "%appdata%", Environ("appdata"))
ProcedureName = Replace(ProcedureName, "%addins%", Environ$("appdata") & "\Microsoft\AddIns")
ProcedureName = Replace(ProcedureName, "%appdata%", Environ$("appdata"))

AddInFile = Left(ProcedureName, InStrRev(ProcedureName, ".")) & "accda"
If Len(VBA.Dir(AddInFile)) = 0 Then
AddInFile = Left$(ProcedureName, InStrRev(ProcedureName, ".")) & "accda"
If Len(Dir(AddInFile)) = 0 Then
Exit Function ' or raise error?
End If

Expand Down
2 changes: 1 addition & 1 deletion Version Control.accda.src/vcs-options.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Info": {
"AddinVersion": "4.0.35-x",
"AddinVersion": "4.0.36-jp",
"AccessVersion": "14.0 32-bit"
},
"Options": {
Expand Down

0 comments on commit 7fc0e27

Please sign in to comment.