MALICIOUS
100
Risk Score
Malware Insights
MITRE ATT&CK
T1059.005 Visual Basic
T1204.002 Malicious File
The file contains VBA macros that reference API calls like GetProcAddress, suggesting dynamic code execution. The CreateObject call further indicates the potential for launching external processes or objects. While no specific download URL is directly visible in the provided script excerpt, the presence of extensive VBA macros and the use of Windows API calls strongly suggest a downloader or dropper functionality. The macros are likely designed to fetch and execute a secondary payload.
Heuristics 3
-
Reference to GetProcAddress API high SC_STR_GETPROCADDRESSReference to GetProcAddress API
-
VBA macros detected medium 1 related finding OLE_VBA_MACROSDocument contains VBA macro code
-
CreateObject call high OLE_VBA_CREATEOBJCreateObject callMatched line in script
Dim oFile Set oFileSystem = CreateObject("Scripting.FileSystemObject") Set oFile = oFileSystem.OpenTextFile(szPrgfile, ForWriting, True)
Extracted artifacts 1
Files carved from inside the sample during analysis.
| Filename | Kind | Source | Size |
|---|---|---|---|
macros.bas |
vba-macro | oletools.olevba.extract_macros (decoded VBA source) | 162457 bytes |
SHA-256: 5fb8196ef355d52a041f1a1344643e9a94d68559cc84b0fb54b226f7648d400f |
|||
Preview scriptFirst 1,000 lines of the extracted script
Attribute VB_Name = "ThisDocument"
Attribute VB_Base = "0{00020906-0000-0000-C000-000000000046}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = True
Attribute VB_Name = "NewMacros"
Type POINTAPI
x As Long
y As Long
End Type
Type MSG
hwnd As Long
message As Long
wParam As Long
lParam As Long
time As Long
pt As POINTAPI
End Type
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Declare Function DeleteFile Lib "kernel32" Alias "DeleteFileA" (ByVal lpFileName As String) As Long
Declare Function InvalidateRect Lib "user32" (ByVal hwnd As Long, ByVal lpRect As Long, ByVal bErase As Long) As Long
Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Declare Function GetDlgItem Lib "user32" (ByVal hDlg As Long, ByVal nIDDlgItem As Long) As Long
Declare Function UpdateWindow Lib "user32" (ByVal hwnd As Long) As Long
Declare Function PeekMessage Lib "user32" Alias "PeekMessageA" (lpMsg As MSG, ByVal hwnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long, ByVal wRemoveMsg As Long) As Long
Declare Function TranslateMessage Lib "user32" (lpMsg As MSG) As Long
Declare Function DispatchMessage Lib "user32" Alias "DispatchMessageA" (lpMsg As MSG) As Long
Declare Function SetDlgItemText Lib "user32" Alias "SetDlgItemTextA" (ByVal hDlg As Long, ByVal nIDDlgItem As Long, ByVal lpString As String) As Long
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
Declare Function POSTMESSAGE Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
Declare Function IsWindow Lib "user32" (ByVal hwnd As Long) As Long
Declare Function GetProfileString Lib "kernel32" Alias "GetProfileStringA" (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long) As Long
Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Declare Function GetPrivateProfileInt Lib "kernel32" Alias "GetPrivateProfileIntA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal nDefault As Long, ByVal lpFileName As String) As Long
Dim hStatic As Long
Const WM_PROGRESS_GEN = 10001
Dim GEN, GLO As Integer
Dim hflag As Integer
Dim QueryID As Integer
Dim szPrgfile As String
'Public Const POSTMESSAGE = 143
Sub AutoNew()
Attribute AutoNew.VB_Description = "Macro recorded 03/11/99 by KKR"
Attribute AutoNew.VB_ProcData.VB_Invoke_Func = "TemplateProject.NewMacros.myMacro1"
'
' myMacro1 Macro
' Macro recorded 03/11/99 by siva
'
On Error Resume Next
szKey$ = "HKEY_LOCAL_MACHINE\Software\eIQ\SecureVue\WordExport"
var$ = System.PrivateProfileString("", szKey$, "LogoFileName")
ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=1, NumColumns:=1
Selection.SelectRow
' Selection.Tables(1).Rows.SetLeftIndent LeftIndent:=0, RulerStyle:=wdAdjustNone
' Selection.Tables(1).Columns(1).SetWidth ColumnWidth:=558, RulerStyle:=wdAdjustNone
Selection.TypeText Text:="."
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.InlineShapes.AddPicture FileName:= _
var$, LinkToFile:=False, _
SaveWithDocument:=True
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeBackspace
Selection.TypeBackspace
Selection.MoveUp Unit:=wdLine, Count:=57
Selection.MoveDown Unit:=wdLine, Count:=11
var$ = System.PrivateProfileString("", szKey$, "OrganizationName")
Dim i As Variant
Dim j As Variant
j = 36
i = Len(var$)
If i >= 24 And i <= 36 Then
j = 30
End If
If i >= 37 And i <= 50 Then
j = 30
End If
ActiveDocument.Shapes.AddTextEffect(msoTextEffect13, var$, _
"Arial", j, msoFalse, msoFalse, 124.1, 240#).Select
Selection.ShapeRange.Align msoAlignCenters, True
Selection.Collapse
Selection.MoveDown Unit:=wdLine, Count:=21
var$ = System.PrivateProfileString("", szKey$, "ReportName")
ActiveDocument.Shapes.AddTextEffect(msoTextEffect8, var$, _
"Arial", 36#, msoFalse, msoFalse, 214.1, 243#).Select
Selection.ShapeRange.Align msoAlignCenters, True
Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 255, 255)
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.IncrementTop 7.2
Selection.ShapeRange.IncrementTop 7.2
Selection.ShapeRange.IncrementTop 7.2
Selection.ShapeRange.IncrementTop 7.2
Selection.ShapeRange.IncrementTop 7.2
Selection.ShapeRange.IncrementTop 7.2
Selection.ShapeRange.IncrementTop 7.2
Selection.ShapeRange.IncrementTop 7.2
Selection.ShapeRange.IncrementTop 7.2
Selection.ShapeRange.IncrementTop 7.2
Selection.ShapeRange.IncrementTop 7.2
Selection.ShapeRange.IncrementTop 7.2
Selection.ShapeRange.IncrementTop 7.2
Selection.ShapeRange.IncrementTop 7.2
Selection.ShapeRange.IncrementTop 7.2
Selection.ShapeRange.IncrementTop -5.4
Selection.Collapse
Selection.MoveDown Unit:=wdLine, Count:=31
Selection.TypeText Text:="Prepared by"
Selection.HomeKey Unit:=wdLine, Extend:=wdExtend
Selection.Font.Size = 18
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeParagraph
var$ = System.PrivateProfileString("", szKey$, "UserName")
Selection.TypeText Text:=var$
Selection.TypeParagraph
Selection.TypeText Text:="on"
Selection.TypeParagraph
Selection.InsertDateTime DateTimeFormat:="d MMMM, yyyy", InsertAsField:= _
False
Application.Run ("Footer1")
Selection.EndKey Unit:=wdStory
Selection.InsertBreak Type:=wdSectionBreakNextPage
Application.Run ("main")
ActiveDocument.ShowSpellingErrors = False
ActiveDocument.ShowGrammaticalErrors = False
End Sub
Sub FileSave()
On Error Resume Next
For Each aTable In ActiveDocument.Tables
aTable.Rows(1).HeadingFormat = True
MsgBox ("File Save")
Next aTable
End Sub
Sub Footer1()
'
' hf Macro
' Macro recorded 03-30-99 by NITEAM
'
On Error Resume Next
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Or ActiveWindow.ActivePane.View.Type _
= wdMasterView Then
ActiveWindow.ActivePane.View.Type = wdPageView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
If Selection.HeaderFooter.IsHeader = True Then
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Else
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
End If
szKey$ = "HKEY_LOCAL_MACHINE\Software\eIQ\SecureVue\WordExport"
var$ = System.PrivateProfileString("", szKey$, "LogoFileName")
ActiveDocument.Shapes.AddPicture Anchor:=Selection.Range, FileName:= _
var$, LinkToFile:=False, SaveWithDocument:= _
True
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
var1$ = System.PrivateProfileString("", szKey$, "ReportType")
If (InStr(var1$, "Monitoring") = 1) Then
Selection.TypeText Text:="Monitoring Analysis"
ElseIf (InStr(var1$, "HTTP") = 1) Then
Selection.TypeText Text:="HTTP Log Analysis"
ElseIf (InStr(var1$, "FTP") = 1) Then
Selection.TypeText Text:="FTP Log Analysis"
ElseIf (InStr(var1$, "Proxy") = 1) Then
Selection.TypeText Text:="Proxy Log Analysis"
ElseIf (InStr(var1$, "Streaming") = 1) Then
Selection.TypeText Text:="Streaming Media Log Analysis"
End If
Selection.HeaderFooter.PageNumbers.Add PageNumberAlignment:= _
wdAlignPageNumberRight, FirstPage:=True
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub
Sub main()
'
' main Macro
' Macro recorded 06-08-99 by
Dim szINIFileName As String
Dim szBuffer As String
Dim wcTables As Integer
Dim wcLoops As Integer
Dim fResult As Long
Dim szTablename As String
Dim szdocname As String
Dim szOutputFilename As String
Dim szSectionName As String
Dim szReportsDir As String
Dim szColumns As String
Dim szTitle As String
Dim hDlg As Long
Dim fViewIt As Long
Dim fGraphs As Long
Dim wProgress As Long
Dim wcRows As Long
Dim wcColumns As Long
Dim fBoldFaceHeader As Long
Dim MyRange As Range
Dim x As Integer
Dim qid As Long
Dim szHelpText1 As String
Dim szHelpText2 As String
x = 2
ActiveWindow.ActivePane.View.Zoom.Percentage = 100
On Error Resume Next
Application.ScreenUpdating = False
szKey$ = "HKEY_LOCAL_MACHINE\Software\eIQ\SecureVue\WordExport"
var$ = System.PrivateProfileString("", szKey$, "ReportFileDirectory")
szINIFileName = var$ & "\FWAWD.INI"
'
' Get HWND of progress bar dialog.
' Get HWND of static text control.
'
hDlg = GetPrivateProfileInt( _
"FirewallAnalyzer", _
"HWND", _
0, _
szINIFileName)
hStatic = GetPrivateProfileInt( _
"FirewallAnalyzer", _
"STATIC", _
0, _
szINIFileName)
fResult = IsWindow(hDlg)
If fResult = 0 Then
' Exit Sub
End If
fResult = IsWindow(hStatic)
If fResult = 0 Then
' Exit Sub
End If
hflag = GetPrivateProfileInt( _
"FirewallAnalyzer", _
"FLAG", _
0, _
szINIFileName)
szPrgfile = String(255, 0)
fResult = GetPrivateProfileString( _
"FirewallAnalyzer", _
"PrgFile", _
"", _
szPrgfile, _
255, _
szINIFileName)
szPrgfile = Left$(szPrgfile, fResult)
UpdateProgress szPrgfile, "Initializing MS-Word report generation...", 0
'
' How many tables?
'
wcTables = GetPrivateProfileInt( _
"FirewallAnalyzer", _
"TotalItems", _
0, _
szINIFileName)
If wcTables < 1 Then
Exit Sub
End If
'
' Should we view the results?
' Does the user wants graphs?
'
fViewIt = GetPrivateProfileInt( _
"FirewallAnalyzer", _
"fViewIt", _
1, _
szINIFileName)
fGraphs = GetPrivateProfileInt( _
"FirewallAnalyzer", _
"Graphs", _
1, _
szINIFileName)
Dim fFormat As Integer
fFormat = GetPrivateProfileInt( _
"FirewallAnalyzer", _
"FORMAT", _
1, _
szINIFileName)
szReportsDir = String(255, 0)
fResult = GetPrivateProfileString( _
"FirewallAnalyzer", _
"ReportsDir", _
"", _
szReportsDir, _
255, _
szINIFileName)
szReportsDir = Left$(szReportsDir, fResult)
'
' Create the target workbook.
'
szOutputFilename = String(255, 0)
fResult = GetPrivateProfileString( _
"FirewallAnalyzer", _
"Output", _
"", _
szOutputFilename, _
255, _
szINIFileName)
szOutputFilename = Left$(szOutputFilename, fResult)
'selection.
'MsgBox szOutputFilename
fResult = DeleteFile(szOutputFilename)
With ActiveDocument
' .Title = "FirewallAnalyzer Report"
.SaveAs FileName:=szOutputFilename
End With
Selection.Font.Italic = wdToggle
' Footer
For wcLoops = 1 To wcTables Step 1
'
' Compute the INI file section name.
szSectionName = LTrim$(Str$(wcTables - (wcLoops + 1)))
' How many columns?
' szSectionName = LTrim$(Str$(wcLoops))
' szBuffer = String(255, 0)
' fResult = GetPrivateProfileString( _
' szSectionName, _
' "Image", _
' "", _
' szBuffer, _
' 255, _
' szINIFileName)
' szBuffer = Left$(szBuffer, fResult)
'
' If fResult <= 0 Then
' Table szSectionName, szINIFileName, szReportsDir, wcLoops, fFormat
' 'ActiveDocument.Save
'
' 'Selection.InsertBreak Type:=wdSectionBreakNextPage
' Else
'
' Table szSectionName, szINIFileName, szReportsDir, wcLoops, fFormat
' Graph szSectionName, szINIFileName, szReportsDir, wcLoops
'
' 'Selection.InsertBreak Type:=wdSectionBreakNextPage
' ' ActiveDocument.Save
'
' End If
szSectionName = LTrim$(Str$(wcLoops))
szBuffer = String(255, 0)
fResult = GetPrivateProfileString( _
szSectionName, _
"Image", _
"", _
szBuffer, _
255, _
szINIFileName)
szBuffer = Left$(szBuffer, fResult)
szTitle = String(255, 0)
fResult1 = GetPrivateProfileString( _
szSectionName, _
"Table", _
"", _
szTitle, _
255, _
szINIFileName)
szTitle = Left$(szTitle, fResult1)
szHelpText1 = String(1024, 0)
fResultH = GetPrivateProfileString( _
szSectionName, _
"HelpText1", _
"", _
szHelpText1, _
1020, _
szINIFileName)
szHelpText1 = Left$(szHelpText1, fResultH)
szHelpText2 = String(1024, 0)
fResultH = GetPrivateProfileString( _
szSectionName, _
"HelpText2", _
"", _
szHelpText2, _
1020, _
szINIFileName)
szHelpText2 = Left$(szHelpText2, fResultH)
UpdateProgress szPrgfile, "Processing..." & szTitle, (wcLoops * 100) / wcTables
If fResult1 > 0 Then
Table szSectionName, szINIFileName, szReportsDir, wcLoops, fFormat
End If
If fResult > 0 Then
Graph szSectionName, szINIFileName, szReportsDir, wcLoops
End If
szTitle = String(255, 0)
fResult = GetPrivateProfileString( _
szSectionName, _
"Table", _
"", _
szTitle, _
255, _
szINIFileName)
szTitle = Left$(szTitle, fResult)
qid = GetPrivateProfileInt( _
szSectionName, _
"QID", _
0, _
szINIFileName)
QueryID = qid
If Not (InStr(szTitle, "Glossary") = 1) Then
test1 szReportsDir, szTitle, qid, szHelpText1, szHelpText2
Selection.InsertBreak Type:=wdSectionBreakNextPage
End If
If hflag <> 0 Then
fResult = IsWindow(hDlg)
If fResult = 0 Then
' GoTo ExitThisThing
End If
wProgress = 100 * ((wcLoops + 1) / wcTables)
If wProgress <> 100 Then
'fResult = SendMessage(hDlg, WM_PROGRESS_GEN, wProgress, 0)
'MsgBox wProgress
UpdateWindow (hDlg)
'Call Peekaboo
End If
End If
Next
UpdateProgress szPrgfile, "Formatting MS-Word Report...", 0
'============================
Dim kok As Integer
For kok = 1 To wcTables
MergeRowsofTable1 kok, szINIFileName, (kok * 100) / wcTables
Selection.EndKey Unit:=wdStory
' MergeRowsofTable2 kok, szINIFileName
' Selection.EndKey Unit:=wdStory
Next
'============================
ActiveWindow.DocumentMap = True
ActiveWindow.DocumentMap = False
' UpdateProgress szPrgfile, "Inserting Table of Contents...", 0
' Selection.HomeKey Unit:=wdStory
' Selection.GoTo what:=wdGoToPage, Which:=wdGoToAbsolute, Count:=2
' Selection.InsertBreak Type:=wdSectionBreakNextPage
' Selection.GoTo what:=wdGoToPage, Which:=wdGoToAbsolute, Count:=2
'
' Application.Run "InsertTOC"
UpdateProgress szPrgfile, "Saving MS-Word Report...", 0
ActiveDocument.Save
UpdateProgress szPrgfile, "MS-Word Report generated.", 0
ExitThisThing:
' Clean up.
'
'fResult = PostMessage(hDlg, POSTMESSAGE_ILU, 100, 0)
If fViewIt > 0 Then
Application.ScreenUpdating = True
' Application.WindowState = wdWindowStateMaximize
Else
Application.Quit
End If
End Sub
Sub Table(szSecName As String, szINIFileName As String, szRepD As String, wcLoop As Integer, fFormt As Integer)
'
' Macro3 Macro
' Macro recorded 06-08-99 by WMT
'
Dim szBuffer As String
Dim wcTables As Integer
Dim wcLoops As Integer
Dim fResult As Long
Dim szTablename As String
Dim szdocname As String
Dim szOutputFilename As String
' Dim szSecName As String
Dim szReportsDir As String
Dim szColumns As String
Dim szTitle As String
Dim hDlg As Long
Dim fViewIt As Long
Dim fGraphs As Long
Dim wProgress As Long
Dim wcRows As Long
Dim wcColumns As Long
Dim nodata As Long
Dim fBoldFaceHeader As Long
Dim MyRange As Range
Dim colSize() As Double
Dim colall() As String
Dim szDesc As String
Dim szTempStr As String
Dim x As Integer
x = 5
'dim sssss as
On Error Resume Next
'Application.ScreenUpdating = False
' How many tables?
'
wcTables = GetPrivateProfileInt( _
"FirewallAnalyzer", _
"TotalItems", _
0, _
szINIFileName)
If wcTables < 1 Then
' Exit Sub
End If
szSecName = LTrim$(Str$(wcLoop))
szTablename = String(255, " ")
fResult = GetPrivateProfileString( _
szSecName, _
"Table", _
"", _
szTablename, _
255, _
szINIFileName)
szTablename = Left$(szTablename, fResult)
szTablename = RTrim(szTablename)
szTablename = LTrim(szTablename)
szTablename = Left(szTablename, Len(szTablename))
szTitle = String(255, " ")
fResult = GetPrivateProfileString( _
szSecName, _
"Table", _
"", _
szTitle, _
255, _
szINIFileName)
szTitle = Left$(szTitle, fResult)
szTitle = RTrim(szTitle)
szTitle = LTrim(szTitle)
szTitle = Left(szTitle, Len(szTitle))
If Len(szTablename) > 0 Then
'
' Tell user which comma-delimited table we're importing...
If hflag <> 0 Then
' DisplayMessage (szTablename)
End If
szBuffer = String(255, 0)
fResult = GetPrivateProfileString( _
szSecName, _
"File", _
"", _
szBuffer, _
255, _
szINIFileName)
szBuffer = Left$(szBuffer, fResult)
If Len(szBuffer) > 0 Then
'
' Tell user which Table we're importing...
wcColumns = GetPrivateProfileInt( _
szSecName, _
"NumColumns", _
0, _
szINIFileName)
wcRows = GetPrivateProfileInt( _
szSecName, _
"NumRows", _
0, _
szINIFileName)
fBoldFaceHeader = GetPrivateProfileInt( _
szSecName, _
"BoldFaceHeader", _
0, _
szINIFileName)
'
' Where are the comma delimited files and the associated image files?
nodata = GetPrivateProfileInt( _
szSecName, _
"ImageFlag", _
0, _
szINIFileName)
szColumns = String(255, 0)
fResult = GetPrivateProfileString( _
szSecName, _
"ColumnWidths", _
"", _
szColumns, _
255, _
szINIFileName)
szColumns = Left$(szColumns, fResult)
Dim szAllign As String
szAllign = String(255, 0)
fResult = GetPrivateProfileString( _
szSecName, _
"ALIGN", _
"", _
szAllign, _
255, _
szINIFileName)
szAllign = Left$(szAllign, fResult)
szDesc = String(455, " ")
fResult = GetPrivateProfileString( _
szSecName, _
"Description", _
"", _
szDesc, _
455, _
szINIFileName)
szDesc = Left$(szDesc, fResult)
szDesc = RTrim(szDesc)
szDesc = LTrim(szDesc)
ll = Len(szDesc)
If ll > 0 Then
szDesc = Left(szDesc, ll)
End If
Dim junkchar As Integer
Dim substrr As String
junkchar = InStrRev(szDesc, "�B")
substrr = Left(szDesc, junkchar)
szDesc = substrr
'wordbasic
Dim tempTableName As String
tempTableName = szTablename
'wordbasic
Selection.Paragraphs.OutlineLevel = wdOutlineLevel1
If Len(tempTableName) > 60 Then
tempTableName = Left(tempTableName, 70)
tempTableName = tempTableName & "..."
End If
Selection.InsertAfter Text:=tempTableName
Selection.Font.Name = "Arial"
Selection.Font.Bold = wdToggle
If Len(szTablename) > 60 Then
Selection.Font.Size = 12
Else
Selection.Font.Size = 14
End If
Selection.Font.ColorIndex = wdBlack
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
ActiveDocument.Shapes.AddShape(msoShapeRectangle, 93.6, 64.8, 512.8, _
22.6).Select
With Selection.ShapeRange
.ZOrder msoSendBehindText
.Fill.Visible = msoTrue
.Fill.Solid
.Fill.ForeColor.RGB = RGB(51, 204, 204)
.Fill.Transparency = 0#
.Line.Weight = 0.75
.Line.DashStyle = msoLineSolid
.Line.Style = msoLineSingle
.Line.Transparency = 0#
.Line.Visible = msoTrue
.Line.ForeColor.RGB = RGB(0, 0, 0)
.Line.BackColor.RGB = RGB(255, 255, 255)
.LockAspectRatio = msoFalse
.Height = 22.6
.Width = 512.8
.Rotation = 0#
.RelativeHorizontalPosition = _
wdRelativeHorizontalPositionColumn
.RelativeVerticalPosition = _
wdRelativeVerticalPositionParagraph
.Left = InchesToPoints(-0.06)
.Top = InchesToPoints(-0.04)
.LockAnchor = False
.WrapFormat.Type = wdWrapNone
.WrapFormat.Side = wdWrapBoth
.WrapFormat.DistanceTop = InchesToPoints(0)
.WrapFormat.DistanceBottom = InchesToPoints(0)
.WrapFormat.DistanceLeft = InchesToPoints(0.13)
.WrapFormat.DistanceRight = InchesToPoints(0.13)
End With
Selection.Collapse
Selection.Font.ColorIndex = wdBlack
Selection.EndKey Unit:=wdLine
Selection.TypeParagraph
Selection.TypeParagraph
Selection.Font.Bold = wdToggle
' Selection.Font.Size = 11
Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
If Not (InStr(szTablename, "Glossary") = 1) Then 'glossary
'Selection.InsertAfter Text:=" "
Selection.InsertAfter Text:=szTablename
End If
Selection.Paragraphs.OutlineLevel = wdOutlineLevelBodyText
'Selection.HomeKey Unit:=wdLine, Extend:=wdExtend
Selection.Font.ColorIndex = wdAuto
Selection.Font.Bold = wdToggle
Selection.Font.Size = 11
'Selection.InsertAfter Text:="."
Selection.InsertAfter Text:=" " & szDesc
Selection.Font.Name = "Arial"
Selection.Font.Size = 11
'Selection.Font.Italic = wdToggle
Selection.Font.Bold = wdToggle
Selection.ParagraphFormat.Alignment = wdAlignParagraphJustify
Selection.Collapse Direction:=wdCollapseEnd
Selection.TypeParagraph
Selection.TypeParagraph
'Selection.Font.Italic = wdToggle
With ActiveDocument.Bookmarks
.Add Range:=Selection.Range, Name:="xy"
.DefaultSorting = wdSortByLocation
.ShowHidden = False
End With
'Selection.InsertFile FileName:=szRepD & szBuffer, Range:="", _
'ConfirmConversions:=False, Link:=False, Attachment:=False
Open szRepD & szBuffer For Input As #6
Do Until EOF(6)
Line Input #6, NextLine
linesfromfile = linesfromfile + NextLine + vbCrLf
Loop
linesfromfile = Left(linesfromfile, Len(linesfromfile) - 2)
Trim linesfromfile
Selection.TypeText linesfromfile
Close #6
Selection.TypeParagraph
Selection.TypeParagraph
With ActiveDocument.Bookmarks
.Add Range:=Selection.Range, Name:="yx"
.DefaultSorting = wdSortByLocation
.ShowHidden = False
End With
Selection.GoTo what:=wdGoToBookmark, Name:="xy"
With ActiveDocument.Bookmarks
.DefaultSorting = wdSortByLocation
.ShowHidden = False
End With
Selection.EndKey Unit:=wdStory, Extend:=wdExtend
'Selection.MoveUp Unit:=wdLine, Count:=1, Extend:=wdExtend
Selection.Font.Size = 10
Selection.EndKey Unit:=wdStory, Extend:=wdExtend
Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
'Selection.MoveUp Unit:=wdLine, Count:=2, Extend:=wdExtend
' Selection.MoveUp Unit:=wdLine, Count:=1, Extend:=wdExtend
Selection.Font.Name = "Arial"
Application.DefaultTableSeparator = "|"
Selection.ConvertToTable Separator:=wdSeparateByDefaultListSeparator, _
NumColumns:=wcColumns, NumRows:=wcRows, Format:=fFormt, _
ApplyBorders:=True, ApplyShading:=True, ApplyFont:=True, ApplyColor:=True _
, ApplyHeadingRows:=True, ApplyLastRow:=False, ApplyFirstColumn:=True, _
ApplyLastColumn:=False, AutoFit:=False
ReDim Preserve colSize(wcColumns) As Double
Dim i As Integer, j As Integer, leng As Integer, InstrL As Integer
leng = Len(szColumns)
Selection.GoTo what:=wdGoToBookmark, Name:="xy"
For i = 0 To wcColumns
InstrL = InStr(szColumns, ",")
j = InstrL
If j = 0 Then
j = Len(szColumns) + 1
End If
colSize(i) = Val(Left(szColumns, j - 1))
If (i <> 0) Then
Selection.SelectColumn
Selection.Cells.SetWidth ColumnWidth:=InchesToPoints(colSize(i)), RulerStyle:= _
wdAdjustNone
Selection.Move Unit:=wdColumn, Count:=1
End If
If InstrL <> 0 Then
szColumns = Right(szColumns, leng - j)
leng = leng - j
End If
Next
ReDim Preserve colall(wcColumns) As String
Dim k As Integer, l As Integer, lens As Integer, InstrLe As Integer
lens = Len(szAllign)
Selection.GoTo what:=wdGoToBookmark, Name:="xy"
For k = 1 To wcColumns
InstrLe = InStr(szAllign, ",")
l = InstrLe
If l = 0 Then
l = Len(szAllign) + 1
End If
'colall(k) = LTrim$(Str$(szAllign, l - 1))
colall(k) = Val(Left(szAllign, l - 1))
If (k <> 0) Then
Selection.SelectColumn
If (l <= 5) Then
Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
Else
Selection.ParagraphFormat.Alignment = wdAlignParagraphRight
End If
'Selection.Cells.SetWidth ColumnWidth:=InchesToPoints(colall(k)), RulerStyle:= _
' wdAdjustNone
Selection.Move Unit:=wdColumn, Count:=1
End If
If InstrLe <> 0 Then
szAllign = Right(szAllign, lens - l)
lens = lens - l
End If
Next
Selection.GoTo what:=wdGoToBookmark, Name:="xy"
With ActiveDocument.Bookmarks
.DefaultSorting = wdSortByLocation
.ShowHidden = False
End With
Selection.Font.Bold = wdToggle
If Not (InStr(szTablename, "Glossary") = 1) Then
If QueryID <> 100 Or QueryID <> 10000 Then
If (nodata <> 2) Then
With Selection
.SelectRow
.Font.Size = 9
.Font.Name = "Arial"
.ParagraphFormat.Alignment = wdAlignParagraphCenter
.Cells.VerticalAlignment = wdCellAlignVerticalCenter
.Shading.Texture = wdTextureNone
.Shading.ForegroundPatternColorIndex = wdAuto
.Shading.BackgroundPatternColorIndex = wdBlack
.GoTo what:=wdGoToBookmark, Name:="yx"
' .MoveUp Unit:=wdLine, Count:=2
' .SelectRow
' .Shading.Texture = wdTextureNone
' .Shading.ForegroundPatternColorIndex = wdWhite
End With
With Selection
Selection.GoTo what:=wdGoToBookmark, Name:="yx"
'==
' Selection.MoveUp Unit:=wdLine, Count:=3
' Selection.SelectRow
' Selection.Font.Bold = wdToggle
' Selection.Font.ColorIndex = wdDarkRed
End With
Else
With Selection
Selection.GoTo what:=wdGoToBookmark, Name:="yx"
'==
' Selection.MoveUp Unit:=wdLine, Count:=3
' Selection.SelectRow
' .Font.Size = 12
' .Font.Name = "Arial"
' Selection.Font.ColorIndex = wdRed
'= wdDarkRed
End With
End If
Else
GEN = wcLoop
Selection.SelectColumn
'Selection.Font.Bold = wdToggle
Selection.Font.Bold = wdToggle
Selection.Move Unit:=wdColumn, Count:=1
Selection.SelectColumn
Selection.Font.Bold = wdToggle
If fFormt <> 35 Then
With Selection
.SelectRow
.Shading.ForegroundPatternColorIndex = wdWhite
.Shading.BackgroundPatternColorIndex = wdAuto
.Font.ColorIndex = wdBlack
End With
End If
End If
Else
GLO = wcLoop
Selection.SelectColumn
Selection.Font.Bold = wdToggle
Selection.Font.Bold = wdToggle
'Selection.MoveLeft Count:=1
Selection.Move Unit:=wdColumn, Count:=1
Selection.SelectColumn
Selection.Font.Bold = wdToggle
Selection.ParagraphFormat.Alignment = wdAlignParagraphJustify
If fFormt <> 35 Then
With Selection
.SelectRow
.Shading.ForegroundPatternColorIndex = wdWhite
.Shading.BackgroundPatternColorIndex = wdAuto
.Font.ColorIndex = wdBlack
End With
End If
End If
Selection.GoTo what:=wdGoToBookmark, Name:="yx"
'ActiveDocument.Bookmarks("yx").Delete
'ActiveDocument.Bookmarks("xy").Delete
'With ActiveDocument.Bookmarks
' .DefaultSorting = wdSortByLocation
' .ShowHidden = False
'End With
End If
End If
'
Selection.TypeParagraph
Selection.TypeParagraph
'Selection.TypeParagraph
End Sub
…
|
|||
Open this report in the interactive analyzer, or submit your own file for analysis.