Skip to content

Commit

Permalink
disable screen updating when checking for broken ref. no release.
Browse files Browse the repository at this point in the history
  • Loading branch information
shishouyuan committed Jun 18, 2021
1 parent 2c26218 commit f23b484
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
16 changes: 12 additions & 4 deletions HandyRef.bas
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
'创建时期: 2021/5/11


Const HandyRefVersion = "20210617.2006.VBA"
Const HandyRefVersion = "20210618.1050.VBA"

Const TEXT_HandyRefGithubUrl = "https://github.com/shishouyuan/HandyRefVBA"

Const BookmarkPrefix = "_HandyRef"
Const RefBrokenCommentTitle = "$HANDYREF_REFERENCE_BROKEN_COMMENT$"

#Const HandyRef_Lang = "en-us"
#Const HandyRef_Lang = "zh-cn"

Const BrokenRefNumPosHolder = "#"

Expand Down Expand Up @@ -266,9 +266,16 @@ Public Sub HandyRef_CheckForBrokenRef_RibbonFun(ByVal control As IRibbonControl)
End Sub

Public Sub HandyRef_CheckForBrokenRef(checkingRange As Range)
Application.UndoRecord.StartCustomRecord FormatUndoRecordText(TEXT_ActionName_CheckReference)

Dim oldScreenUpdating As Boolean
oldScreenUpdating = Application.ScreenUpdating

On Error GoTo errHandle

Application.ScreenUpdating = False

Application.UndoRecord.StartCustomRecord FormatUndoRecordText(TEXT_ActionName_CheckReference)

HandyRef_ClearRefBrokenComment checkingRange

Static refRegExp As Object
Expand Down Expand Up @@ -323,6 +330,7 @@ Public Sub HandyRef_CheckForBrokenRef(checkingRange As Range)
End If

exitSub:
Application.ScreenUpdating = oldScreenUpdating
Application.UndoRecord.EndCustomRecord
Exit Sub

Expand Down Expand Up @@ -358,4 +366,4 @@ Public Sub HandyRef_GetLatestVersion_RibbonFun(ByVal control As IRibbonControl)
errHandle:
ShowUnknowErrorPrompt err

End Sub
End Sub
7 changes: 5 additions & 2 deletions HandyRef.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var TEXT_ActionName_ClearRefBrokenComment

function HandyRef_OnLoad(ribbonUI) {

HandyRefVersion = "20210616.2006.JS"
HandyRefVersion = "20210618.1050.JS"

TEXT_HandyRefGithubUrl = "https://github.com/shishouyuan/HandyRefVBA"

Expand Down Expand Up @@ -126,7 +126,7 @@ function HandyRef_CreateReferencePoint_RibbonFun(control) { // wrap the function

function HandyRef_CreateReferencePoint() {
var rg = Application.Selection.Range
if(selectedRange && Application.IsObjectValid(selectedRange) && rg.IsEqual(selectedRange)){
if (selectedRange && Application.IsObjectValid(selectedRange) && rg.IsEqual(selectedRange)) {
return
}
else {
Expand Down Expand Up @@ -268,7 +268,9 @@ function HandyRef_CheckForBrokenRef_RibbonFun(control) {
}

function HandyRef_CheckForBrokenRef(checkingRange) {
var oldScreenUpdating = Application.ScreenUpdating
try {
Application.ScreenUpdating = false
Application.UndoRecord.StartCustomRecord(HandyRef_FormatUndoRecordText(TEXT_ActionName_CheckReference))
HandyRef_ClearRefBrokenComment(checkingRange)

Expand Down Expand Up @@ -317,6 +319,7 @@ function HandyRef_CheckForBrokenRef(checkingRange) {
HandyRef_ShowUnknowErrorPrompt(err.message)
}
finally {
Application.ScreenUpdating = oldScreenUpdating
Application.UndoRecord.EndCustomRecord()
}

Expand Down
Binary file modified HandyRef/HandyRef-Dev.dotm
Binary file not shown.

0 comments on commit f23b484

Please sign in to comment.