office-macros

VBA Macros for Microsoft Office products

https://github.com/clam-/office-macros

Science Score: 18.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (1.8%) to scientific vocabulary
Last synced: 10 months ago · JSON representation ·

Repository

VBA Macros for Microsoft Office products

Basic Info
  • Host: GitHub
  • Owner: Clam-
  • Language: Visual Basic
  • Default Branch: master
  • Size: 3.91 KB
Statistics
  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created about 11 years ago · Last pushed over 7 years ago
Metadata Files
Readme Citation

README.md

Macros for Office Applications

Here are some macros that may be useful when working with Office applications.

BorderTotals.vb
Useful for adding a border to a "row" that is a total (defined as starting with the cell containing "Total" continuing to the last non empty cell.)

HideZeroRows.vb
Useful for hiding rows that contain numbers which are all zero. Only numbers will be checked and the row will be hidden if all numbers are zero regardless of other text.

Owner

  • Login: Clam-
  • Kind: user

Citation (CitationProcessing.bas)

Attribute VB_Name = "CitationProcessing"
Sub FootnoteConvert()
Dim lngIndex As Long
Dim oFN As Footnote
Dim oRng As Word.Range
  For lngIndex = ActiveDocument.Footnotes.Count To 1 Step -1
    Set oFN = ActiveDocument.Footnotes(lngIndex)
    oFN.Reference.InsertBefore " "
    oFN.Reference.InsertAfter ""
    Set oRng = oFN.Reference
    With oRng
      .Move wdCharacter, -1
      .FormattedText = oFN.Range.FormattedText
    End With
    oFN.Delete
  Next
lbl_Exit:
  Exit Sub
End Sub

Sub CitationCheckMove()
Dim oRng As Word.Range
Dim iBoxVal As Integer
Dim bModified As Boolean
Dim bPause As Boolean
Dim iPause As Integer

  iPause = MsgBox("Pause on every citation? (Otherwise only modified)", 36) ' 6 yes 7 no
  bPause = IIf(iPause = 6, True, False)

  Selection.EndKey Unit:=wdStory, Extend:=wdExtend
  Set tField = Selection.Range.Fields
  For Each fld In tField
    bModified = False
    If fld.Type = 81 Then
      fld.Select
      Set oRng = Selection.Range
      oRng.Start = oRng.Start - 1
      If Left(oRng.Text, 1) = "." Then
        oRng.Start = oRng.Start + 1
        oRng.Cut
        oRng.Start = oRng.Start - 1
        oRng.InsertBefore " "
        oRng.Collapse
        oRng.Start = oRng.Start + 1
        oRng.Paste
        ActiveWindow.SmallScroll Down:=5
        If (oRng.TextVisibleOnScreen <= 0) Then
          ActiveWindow.SmallScroll Up:=5
        End If
        iBoxVal = MsgBox("Moved Citation. Continue?", 49)
        bModified = True
        If iBoxVal = 2 Then
            End
        End If
      Else
        oRng.Start = oRng.Start - 1
        If Left(oRng.Text, 2) = ". " Then
          ' Odd case for . (citation).
          oRng.End = oRng.End + 1
          If Right(oRng.Text, 1) = "." Then
            oRng.End = oRng.End - 1
            oRng.Start = oRng.Start + 1
            oRng.Cut
            oRng.Delete 1
            oRng.Start = oRng.Start - 2
            oRng.Collapse
            oRng.Start = oRng.Start + 1
            oRng.Paste
          Else
            oRng.End = oRng.End - 1
            oRng.Start = oRng.Start + 1
            oRng.Cut
            oRng.Start = oRng.Start - 2
            oRng.Collapse
            oRng.Start = oRng.Start + 1
            oRng.Paste
          End If
          ActiveWindow.SmallScroll Down:=5
          If (oRng.TextVisibleOnScreen <= 0) Then
            ActiveWindow.SmallScroll Up:=5
          End If
          iBoxVal = MsgBox("Moved Citation. Continue?", 49)
          bModified = True
          If iBoxVal = 2 Then
            End
          End If
        End If
      End If
      If Not bModified And bPause Then
        ActiveWindow.SmallScroll Down:=5
        ActiveWindow.ScrollIntoView oRng
        iBoxVal = MsgBox("No preceeding period found. Continue? ", 33)
        If iBoxVal = 2 Then
          End
        End If
      End If
    End If
  Next
End Sub

GitHub Events

Total
Last Year