Submarine Reporter for Excel 2010 BETA 1.3 UPDATED 10/28/2011 (Full Version)

All Forums >> [New Releases from Matrix Games] >> War in the Pacific: Admiral's Edition >> Tech Support



Message


rcm1616 -> Submarine Reporter for Excel 2010 BETA 1.3 UPDATED 10/28/2011 (10/8/2011 2:08:53 PM)

Submarine Reporter for Excel 2010
*******************************************************************************************************************
Update 10/28/11
Version BETA 1.3 - another update from Bruce (bk19@mweb.co.za)

*******************************************************************************************************************
Update 10/14/11
Version BETA 1.2a - massive update from bk19@mweb.co.za
FIXED most of data importing related problems

*******************************************************************************************************************

Update 10/13/11
Last time I have uploaded wrong file. (SAME VERSION AS BEFORE) [:(]
Now you can download real version BETA1.1a ...


*******************************************************************************************************************

Update 10/10/11

Changes in version BETA1.1a (10/10/2011)

1. failure of DB import on platforms where WITP AE was installed on other then c: drive
FIXED - thanks to bk19@mweb.co.za

2. DATE format bug on US/UK Excel localisation
FIXED - thanks to bk19@mweb.co.za

3. all bugs in BAT file execution
FIXED - thanks to bk19@mweb.co.za

4. unable to import combat record where ship name in combat report is without class type prefix (example APD -107 instead APD APD -107)
script which write new record to Combat Reports table is unable to found long name match in ShipsDB
FIXED - class type name is no more added in front of ship name in case that ship name is number


*******************************************************************************************************************



I have developed MS Excel 2010 tool for parsing submarine combat records data from combat and operational reports.
This is strictly Excel2010 worksheet. I had never tested it on older version. It is first BETA version.
Your feedback will be welcomed.


Features:
- load and parse Sub Attack, Sub vs Sub, and ASW type records from combatreport file and save it to excel table
(only records where some damage on side of Target was reported - in case of ASW only records where submarine strikes back)

- append ship (target) tonnage, ship nationality and submarine nationality to records

- load and parse SUNK ship report and FALSELY REPORTED SUNK report types from operationsreport file

- generate reports (pivot tables) monthly tonnage (sunk/damaged) and Submarine top scoring list

This is strictly Excel2010 worksheet. I had never tested it on older version.


Configuration instructions:

Configuration Sheet:

Settings:
1.
WITP AE Path - path to WITP AE Game folder - to point import scripts to combatreport.txt a Xoperationsreport.txt files
2.
TMP File Path - path to any folder which can be used as temporary storage for small auxillary text file - do not need copy any game files there
3.
Import from and Import to date - values must be correctly in date format ( example: from: 7.12.1941 to 31.12.1941 or from 7/12/41 to 31/12/41)
Values are used for batch importing combat reports from [WITP AE Path]\SAVE\archive (combatreport_YYMMDD.txt and Xoperationsreport_YYMMDD.txt files)
4.
Scenario # - number of scenario from which ship data will be imported

Buttons:
1.
Database import - will import ship database from scenario files. Script use witploadAE utilitz to extract data from scenario to .csv files and then import data do Submarine Reporter. It is critical to wait until witploadae exports all files and then click OK button on messagebox to continue.
2.
Import record - will process last saved combat and operations reports from \SAVE folder
3.
Import archive records - will process reports from \SAVE\archive folder within selected range

Combat Reports Sheet:
Main database sheet - all submarine scoring records are stored here
Values in Sunk column:
DAMAGED - initial value (only combat records where sub commander reports damage of enemy ship are stored)
SUNK - sunk confirmed in operations report
FR SUNK - changed after reporting incorrect previous sunk report in operations report

MONTHS:
pivot tables with filters

AUX:
Values in nationality can be changed.

Download:






cantona2 -> RE: Submarine Reporter for Excel 2010 BETA (10/8/2011 3:09:41 PM)

I cant get this to work at all rcm1616

Do i need witpaeload running before I can use it? I use Tracker not witpaeload.
What happens if i have several games running from the same Save folder?




rcm1616 -> RE: Submarine Reporter for Excel 2010 BETA (10/8/2011 3:43:15 PM)

quote:

ORIGINAL: cantona2

I cant get this to work at all rcm1616

Do i need witpaeload running before I can use it? I use Tracker not witpaeload.
What happens if i have several games running from the same Save folder?



No you do not. SR runs witploadae automatically after you click on"Database Import Button.

You may see something like this:


[image]local://upfiles/32487/BA9817D28ACD4C8AA6BB207E49FBAF66.jpg[/image]



No tests with several games yet. But SR opens only files named combatreport.txt, aoperationsreport.txt and joperationsreport.txt from \SAVE folder.




cantona2 -> RE: Submarine Reporter for Excel 2010 BETA (10/8/2011 4:14:00 PM)

I see all that but i get an error saying the programme cannot find wtipcls001.csv in the scenario folder




Dan Nichols -> RE: Submarine Reporter for Excel 2010 BETA (10/8/2011 4:31:48 PM)

I didn't see the cmd window. I got a working icon for 3-4 minutes and then when I tried to see the data I got an error saying the program connot find wticls002.csv. I looked and there are no csv files in my scen folder.




rcm1616 -> RE: Submarine Reporter for Excel 2010 BETA (10/8/2011 4:33:13 PM)


quote:

ORIGINAL: cantona2

I see all that but i get an error saying the programme cannot find wtipcls001.csv in the scenario folder


And is there file with this name?
Is your WITP AE Path set correctly? - with no \ at end of line

If you click Debug on error message on which line of code program stops?





rcm1616 -> RE: Submarine Reporter for Excel 2010 BETA (10/8/2011 4:41:56 PM)


quote:

ORIGINAL: Dan Nichols

I didn't see the cmd window. I got a working icon for 3-4 minutes and then when I tried to see the data I got an error saying the program connot find wticls002.csv. I looked and there are no csv files in my scen folder.


Check if you have witploadae.exe in your SCEN folder. I use updated witploadae from BETA version.




cantona2 -> RE: Submarine Reporter for Excel 2010 BETA (10/8/2011 4:42:19 PM)

quote:

'' Čo treba dorobiť:
''
''  - kontrolu či nechcem importovať už naimportované dáta
''
''

''
''
''
''
''



Dim WITPAEPath, TMPPath, BATPath As String
Dim ActionDate As Date
Dim ImportFromDate, ImportToDate As Date
Dim ScenNo, Side As String


Sub MakeBAT()
Dim fs, f
Dim Line As String

   Line = "witploadAE.exe" & "/s" & ScenNo & " /e /b,"

   Set fs = CreateObject("Scripting.FileSystemObject")
   Set f = fs.OpenTextFile(BATPath, 8, True, 0)

   f.Writeline ("c:")
   f.Writeline ("cd " + WITPAEPath + "\SCEN")
   f.Writeline (Line)
   f.Close

End Sub

Sub DelBAT()
Dim fs, f

   Set fs = CreateObject("Scripting.FileSystemObject")
   fs.DeleteFile BATPath


End Sub
Sub DeleteSheet(strSheetName As String)
' deletes a sheet named strSheetName in the active workbook
   Application.DisplayAlerts = False
   Sheets(strSheetName).Delete
   Application.DisplayAlerts = True
End Sub

Sub ImportDataWorksheets()
Dim LastRow As Double
Dim FileName, BookName, SheetName As String
Dim MyBookName As String
   
   ''DeleteSheet ("Classes")
   ''DeleteSheet ("Ships")
      
   SheetName = "witpcls" + ScenNo
   BookName = SheetName + ".csv"
   FileName = WITPAEPath + "\SCEN\" + BookName
   MyBookName = ActiveWorkbook.Name
  
  
   Workbooks.Open (FileName), , , 2
   Workbooks(BookName).Sheets(1).Copy _
        After:=Workbooks(MyBookName).Sheets("AUX")

   Workbooks(BookName).Close SaveChanges:=False
   Worksheets(SheetName).Name = "Classes"

   SheetName = "witpshp" + ScenNo
   BookName = SheetName + ".csv"
   FileName = WITPAEPath + "\SCEN\" + SheetName
  
  
   Workbooks.Open (FileName), , , 2
   Workbooks(BookName).Sheets(1).Copy _
        After:=Workbooks(MyBookName).Sheets("AUX")
       
   Workbooks(BookName).Close SaveChanges:=False
   Worksheets(SheetName).Name = "Ships"
  
   Call PrepareShipsDB
   DeleteSheet ("Classes")
   DeleteSheet ("Ships")
  
End Sub

Sub PrepareShipsDB()
Dim MyWrkSht As Worksheet
Dim MyRange As Range
Dim i, j, LastRow, LastRowClasses As Double
Dim s As String
Dim MyVarA, MyVarB


' Clear all Cells in ShipsDB to prepare sheet to new data
LastRow = GetLastRow("ShipsDB")
s = "A2:" & "K" & CStr(LastRow)
Set MyWrkSht = ActiveWorkbook.Worksheets("ShipsDB")
Set MyRange = MyWrkSht.Range(s)
MyRange.ClearContents

LastRowClasses = GetLastRow("Classes")
LastRow = GetLastRow("Ships")
i = 2
j = 2

Do While i <= LastRow
   If ActiveWorkbook.Worksheets("Ships").Cells(i, 3) <> 0 Then
       '' SHIP ID
       MyWrkSht.Cells(j, 1).Value = ActiveWorkbook.Worksheets("Ships").Cells(i, 1)
       '' SHIP NAME
       MyWrkSht.Cells(j, 2).Value = ActiveWorkbook.Worksheets("Ships").Cells(i, 2)
       '' CLASS ID
       MyWrkSht.Cells(j, 3).Value = ActiveWorkbook.Worksheets("Ships").Cells(i, 3)
       '' NATIONALITY ID
       MyWrkSht.Cells(j, 4).Value = ActiveWorkbook.Worksheets("Ships").Cells(i, 15)
       '' NATIONALITY
       MyVarA = Application.WorksheetFunction.Match(MyWrkSht.Cells(j, 4).Value, Worksheets("AUX").Range("D2:D19"))
       MyVarB = Application.WorksheetFunction.HLookup("Nationality", Worksheets("AUX").Range("E2:E19"), MyVarA)
       MyWrkSht.Cells(j, 5).Value = MyVarB
       '' Type ID
       s = "A2:A" & CStr(LastRowClasses)
       MyVarA = Application.WorksheetFunction.Match(MyWrkSht.Cells(j, 3).Value, Worksheets("Classes").Range(s))
       MyWrkSht.Cells(j, 6).Value = ActiveWorkbook.Worksheets("Classes").Cells(MyVarA + 1, 3).Value
       '' Type
       MyVarA = Application.WorksheetFunction.Match(MyWrkSht.Cells(j, 6).Value, Worksheets("AUX").Range("A2:A84"))
       MyVarB = Application.WorksheetFunction.HLookup("Type", Worksheets("AUX").Range("B2:B84"), MyVarA)
       MyWrkSht.Cells(j, 7).Value = MyVarB
       '' Full Name
       s = MyWrkSht.Cells(j, 7).Value & " " & MyWrkSht.Cells(j, 2).Value
       MyWrkSht.Cells(j, 8).Value = s
       '' Tonnage
       s = "A2:A" & CStr(LastRowClasses)
       MyVarA = Application.WorksheetFunction.Match(MyWrkSht.Cells(j, 3).Value, Worksheets("Classes").Range(s))
       MyWrkSht.Cells(j, 9).Value = ActiveWorkbook.Worksheets("Classes").Cells(MyVarA + 1, 22).Value
       j = j + 1
   End If
   i = i + 1
Loop

''MyWrkSht.Range(s).FormatConditions


Set MyRange = Nothing
Set MyWrkSht = Nothing

End Sub



Sub LoadConfig()


   WITPAEPath = Worksheets("Configuration").Cells(3, 3).Value
   TMPPath = Worksheets("Configuration").Cells(4, 3).Value + "\RCMTMP.txt"
   BATPath = Worksheets("Configuration").Cells(3, 3).Value + "\SCEN\DUMPSCEN.bat"
   ImportFromDate = Worksheets("Configuration").Cells(5, 3).Value
   ImportToDate = Worksheets("Configuration").Cells(6, 3).Value
   ScenNo = Worksheets("Configuration").Cells(7, 3).Value
   Side = Worksheets("Configuration").Cells(8, 3).Value

End Sub

Sub LoadDB()
Dim RetVar
Dim ImWrkSht As Worksheet
Dim ImRange As Range
Dim MsgBoxResponse As String


   LoadConfig
   MakeBAT
   RetVar = Shell(BATPath, vbNormalFocus)
   MsgBoxResponse = MsgBox("Wait for dumping end, then press OK", vbOKOnly)
  
  
   DelBAT
   ImportDataWorksheets

  
  

End Sub
Function GetLastRow(WrkShtName As String) As Double

Dim MyWrkSht As Worksheet
Dim MyRange As Range

   Set MyWrkSht = ActiveWorkbook.Worksheets(WrkShtName)
   Set MyRange = MyWrkSht.UsedRange

   GetLastRow = MyRange.Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row

   Set MyRange = Nothing
   Set MyWrkSht = Nothing

End Function

Sub ImportReport()
Dim Path As String

   LoadConfig
   Path = WITPAEPath + "\SAVE\combatreport2.txt"
   OpenCombatReport (Path)
   Path = WITPAEPath + "\SAVE\" & Side & "operationsreport2.txt"
   OpenOperationsReport (Path)
      
      
   Call RemoveDuplicates
   Call RefreshPivotTables
      
End Sub
Sub RemoveDuplicates()
Dim MyWrkSht As Worksheet
Dim MyRange As Range
Dim a

   Set MyWrkSht = ActiveWorkbook.Worksheets("Combat Reports")
   Set MyRange = MyWrkSht.UsedRange
 
   MyRange.RemoveDuplicates Columns:=Array(1, 2, 3, 4, 5, 6, 7), Header:=xlYes
  
   Set MyRange = Nothing
   Set MyWrkSht = Nothing
End Sub
Sub RefreshPivotTables()
Dim s As String
Dim LastRow As Double


   LastRow = GetLastRow("Combat Reports")
   s = "Combat Reports!R1C1:R" & CStr(LastRow) & "C7"


   ActiveWorkbook.Worksheets("MONTHS").PivotTables("MonthReview").SourceData = s
   ActiveWorkbook.Worksheets("MONTHS").PivotTables("SubmarineReview").SourceData = s
   ActiveWorkbook.Worksheets("MONTHS").PivotTables("MonthReview").RefreshTable
   ActiveWorkbook.Worksheets("MONTHS").PivotTables("SubmarineReview").RefreshTable

End Sub
Sub OpenOperationsReport(ORPath As String)
Dim fs, f
Dim LastRow As Double
Dim ShipName As String
Dim SunkDate As Date
Dim MyLine
Dim s As String
Dim MyWrkSht As Worksheet
Dim MyRange As Range
  
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile(ORPath, 1, 0)
MyLine = ""

Set MyWrkSht = ActiveWorkbook.Worksheets("Combat Reports")

Set MyRange = MyWrkSht.UsedRange
LastRow = GetLastRow("Combat Reports")

Do While f.AtEndOfStream = False
   MyLine = f.Readline
   If InStr(1, MyLine, "reported to have been sunk", vbTextCompare) > 0 Then
       ShipName = GetSunkShipName(MyLine)
       SunkDate = GetSunkShipDate(MyLine)
       Set MyRange = MyWrkSht.Rows(1)
       i = 2
       Do While i <= LastRow
           If MyWrkSht.Cells(i, 1).Value = SunkDate Then
               If MyWrkSht.Cells(i, 4).Value = ShipName Then
                   MyWrkSht.Cells(i, 6).Value = "SUNK"
                   i = LastRow
               End If
           End If
           i = i + 1
       Loop
   End If
   If InStr(1, MyLine, "Previous report of sinking", vbTextCompare) > 0 Then
       ShipName = GetFalseReportedShipName(MyLine)
       ''SunkDate = GetSunkShipDate(MyLine)
       Set MyRange = MyWrkSht.Rows(1)
       i = LastRow
       Do While (MyWrkSht.Cells(i, 4).Value <> ShipName) And (i > 1)
           i = i - 1
       Loop
       If MyWrkSht.Cells(i, 4).Value = ShipName Then MyWrkSht.Cells(i, 6).Value = "FR SUNK"
   End If
Loop

f.Close
End Sub

Function GetSunkShipName(MyLine) As String
Dim i As Long

   i = InStr(1, MyLine, "is reported", vbTextCompare) - 2
   GetSunkShipName = Left(MyLine, i)

End Function
Function GetShipShortName(LongShipName As String) As String

Dim i As Double
   i = InStr(LongShipName, " ")
   GetShipShortName = Right(LongShipName, Len(LongShipName) - i)
End Function


Function GetFalseReportedShipName(MyLine) As String
Dim i, j As Long
Dim s As String

   i = InStr(1, MyLine, "of sinking of", vbTextCompare) + 13
   j = Len(MyLine)
   s = Right(MyLine, j - i)
   i = InStr(1, s, "incorrect", vbTextCompare) - 2
   GetFalseReportedShipName = Left(s, i)
End Function

Function GetSunkShipDate(ShipLine) As Date
Dim sDate As String
Dim s, sDay, sMonth, sYear As String

   sDate = Right(ShipLine, 12)
   sYear = Right(sDate, 4)
   sDay = Mid(sDate, 5, 2)
   sMonth = GetMonth(Left(sDate, 3))
   s = sDay + "." + sMonth + "." + sYear
   GetSunkShipDate = DateValue(s)

End Function


Sub ImportArchiveReports()
Dim ArchivePath, Path As String
Dim m As Integer
Dim YY, MM, DD, s As String
Dim iDay As Date
   LoadConfig
   ArchivePath = Worksheets("Configuration").Cells(3, 3).Value + "\SAVE\archive"
   iDay = ImportFromDate

   '' Sem by mala ešte prísť kontrola, či už reporty z daného dátumu neboli naimportované
  


   Do While iDay <= ImportToDate
       DD = Day(iDay)
       If Len(DD) < 2 Then DD = "0" & DD
       m = Month(iDay)
       If m < 10 Then
           MM = "0" & CStr(m)
       Else: MM = CStr(m)
       End If
       YY = Year(iDay)
       YY = Right(YY, 2)
       Path = ArchivePath + "\combatreport_" + CStr(YY) + CStr(MM) + CStr(DD) + ".txt"
       If Dir(Path) <> "" Then OpenCombatReport (Path)
       Path = ArchivePath & "\" & Side & "operationsreport_" + CStr(YY) + CStr(MM) + CStr(DD) + ".txt"
       If Dir(Path) <> "" Then OpenOperationsReport (Path)
             
       iDay = iDay + 1
   Loop
   Call RemoveDuplicates
   Call RefreshPivotTables

End Sub


Sub OpenCombatReport(ReportPath As String)
   Const ForReading = 1, ForWriting = 2, ForAppending = 8
   Dim tf, fs, f
   Dim Path, Line As String
   Dim i As Integer
     
   Set fs = CreateObject("Scripting.FileSystemObject")
   Set f = fs.OpenTextFile(ReportPath, 1, 0)
   Set tf = fs.OpenTextFile(TMPPath, 8, True, 0)

   i = 1
   ParserStream = ""
     
   Do While f.AtEndOfStream = False
       Line = f.Readline
       If Line = "--------------------------------------------------------------------------------" Then
           ' call parser Sub with ParserStream argument
           tf.Close
           ParseModule (TMPPath)
           fs.DeleteFile (TMPPath)
          
           Set tf = fs.OpenTextFile(TMPPath, 8, True, 0)
       Else
           If IsNewDay(Line) Then ActionDate = GetDayDate(Line)
           tf.Writeline (Line)
       End If
       i = i + 1
   Loop
   Worksheets("Configuration").Cells(10, 3).Value = ActionDate
   f.Close
End Sub

Function IsNewDay(s As String) As Boolean

   If Mid(s, 1, 12) = "AFTER ACTION" Then
   IsNewDay = True
   Else: IsNewDay = False
   End If
  
End Function

Function GetDayDate(DateLine As String) As Date
Dim LineL As Integer
Dim s, sMonth, sDay, sYear As String

   LineL = Len(DateLine)
   s = Mid(DateLine, LineL - 9, 10)
   sMonth = GetMonth(Mid(s, 1, 3))
   sDay = Mid(s, 5, 2)
   sYear = Mid(s, 9, 2)
   s = sDay + "." + sMonth + "." + "19" + sYear
   GetDayDate = DateValue(s)

End Function

Sub ParseModule(TMPPath As String)

Dim Line, Ship As String
Dim fs, f
Dim arr
Dim s
Dim RowB, RowD As String

Dim JapArr(15) As String
Dim AllArr(15) As String
Dim i As Integer
Dim LastRow&
Dim isJapAttacker As Boolean

Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile(TMPPath, 1, 0)
   Line = f.Readline
   i = 0
   isJapAttacker = False
Select Case Mid(Line, 1, 3)
   Case "Sub"
       ' Parse Ship Names from rcm_tmp.txt to JappArr and AllArr collections of ship names
       Do While f.AtEndOfStream = False
       Line = f.Readline
       If InStr(Line, "Japanese Ships") > 0 Then
           Do Until Line = " "
           Line = f.Readline
           arr = Split(Line, ",", , 1)
           If (UBound(arr) > 0 Or InStr(Line, "SS")) Then
               Ship = arr(0)
               Ship = Mid(Ship, 7)
               JapArr(i) = Ship
               ' if Jap ship is SS then set isJapAttacker as true
               If InStr(Line, "SS") Then isJapAttacker = True
               i = i + 1
           End If
           Loop
           i = 0
       End If
       If InStr(Line, "Allied Ships") > 0 Then
       Do Until Line = " "
           Line = f.Readline
           arr = Split(Line, ",", , 1)
           If (UBound(arr) > 0 Or InStr(Line, "SS")) Then
               Ship = arr(0)
               Ship = Mid(Ship, 7)
               AllArr(i) = Ship
               ' if isJapAttacker is set as true (jap ship was SS) AND Allied ship is SS then if Allied ship is NOT damaged then isJapAttacker set to false
               If isJapAttacker Then
                  If (UBound(arr) = 0 And InStr(Line, "SS")) Then isJapAttacker = False
               End If
               i = i + 1
           End If
           Loop
       End If
       Loop
       If isJapAttacker Then
           i = 0
           Do While AllArr(i) <> ""
               Call WriteCRRow(ActionDate, JapArr(0), AllArr(i))
               i = i + 1
           Loop
       Else
           i = 0
           Do While JapArr(i) <> ""
               Call WriteCRRow(ActionDate, AllArr(0), JapArr(i))
               i = i + 1
           Loop
       End If
       isJapAttacker = False
   Case "ASW"
       Do While f.AtEndOfStream = False
       Line = f.Readline
       If InStr(Line, "Japanese Ships") > 0 Then
           Do Until Line = " "
           Line = f.Readline
           arr = Split(Line, ",", , 1)
           If (UBound(arr) > 0 Or InStr(Line, "SS")) Then
               Ship = arr(0)
               Ship = Mid(Ship, 7)
               JapArr(i) = Ship
               ' if Jap ship is SS then set isJapAttacker as true
               If InStr(Line, "SS") Then isJapAttacker = True
               i = i + 1
           End If
           Loop
           i = 0
       End If
       If InStr(Line, "Allied Ships") > 0 Then
       Do Until Line = " "
           Line = f.Readline
           arr = Split(Line, ",", , 1)
           If (UBound(arr) > 0 Or InStr(Line, "SS")) Then
               Ship = arr(0)
               Ship = Mid(Ship, 7)
               AllArr(i) = Ship
               ' if isJapAttacker is set as true (jap ship was SS) AND Allied ship is SS then if Allied ship is NOT damaged then isJapAttacker set to false
               If isJapAttacker Then
                  If (UBound(arr) = 0 And InStr(Line, "SS")) Then isJapAttacker = False
                  End If
               i = i + 1
           End If
           Loop
       End If
       Loop
       If isJapAttacker Then
           i = 0
           Do While AllArr(i) <> ""
               Call WriteCRRow(ActionDate, JapArr(0), AllArr(i))
               i = i + 1
           Loop
       Else
           i = 0
           Do While JapArr(i) <> ""
               Call WriteCRRow(ActionDate, AllArr(0), JapArr(i))
               i = i + 1
           Loop
       End If
       isJapAttacker = False
   Case Else
End Select


i = 0
f.Close
End Sub
Function GetMonth(ParsedDateString As String) As String

Select Case ParsedDateString

   Case "Jan"
       GetMonth = "01"
   Case "Feb"
       GetMonth = "02"
   Case "Mar"
       GetMonth = "03"
   Case "Apr"
       GetMonth = "04"
   Case "May"
       GetMonth = "05"
   Case "Jun"
       GetMonth = "06"
   Case "Jul"
       GetMonth = "07"
   Case "Aug"
       GetMonth = "08"
   Case "Sep"
       GetMonth = "09"
   Case "Oct"
       GetMonth = "10"
   Case "Nov"
       GetMonth = "11"
   Case "Dec"
       GetMonth = "12"
   End Select

End Function

Private Sub WriteCRRow(RowA As Date, RowB As String, RowD As String)

Dim MyWrkSht As Worksheet
Dim MyRange As Range
Dim LastRow&, LastRowShipsDB
Dim s, ss As String
Dim MyVarA, i As Double
Dim err As Variant


Set MyWrkSht = ActiveWorkbook.Worksheets("Combat Reports")
Set MyRange = MyWrkSht.UsedRange

   LastRow = MyRange.Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
   LastRowShipsDB = GetLastRow("ShipsDB")
   s = "H1:H" & CStr(LastRowShipsDB)
   MyVarA = Application.WorksheetFunction.Match(RowB, Worksheets("ShipsDB").Range(s), 0)
   i = ActiveWorkbook.Worksheets("ShipsDB").Cells(MyVarA, 4).Value
  
   If (Side = "a" And i > 3) Or (Side = "j" And i < 3) Then
       '' Date
       MyWrkSht.Cells(LastRow + 1, 1).Value = RowA
       '' Long Submarine Name
       MyWrkSht.Cells(LastRow + 1, 2).Value = RowB
       '' Submarine Nation
       MyWrkSht.Cells(LastRow + 1, 3).Value = ActiveWorkbook.Worksheets("ShipsDB").Cells(MyVarA, 5).Value
       '' Long Victim Name
       MyWrkSht.Cells(LastRow + 1, 4).Value = RowD
       '' Tonnage
      
      
      
       '' if ship type is same MATCH then write tonnage
       s = "H1:H" & CStr(LastRowShipsDB)
       err = Application.Match(RowD, Worksheets("ShipsDB").Range(s), 0)
       If IsError(err) Then
           s = "B1:B" & CStr(LastRowShipsDB)
           ss = GetShipShortName(RowD)
           MyVarA = Application.Match(ss, Worksheets("ShipsDB").Range(s), 0)
           MyWrkSht.Cells(LastRow + 1, 5).Value = ActiveWorkbook.Worksheets("ShipsDB").Cells(MyVarA, 9).Value
      
       '' If ship type is diferent then lookup next short name match
       Else
           s = "H1:H" & CStr(LastRowShipsDB)
           MyVarA = Application.Match(RowD, Worksheets("ShipsDB").Range(s), 0)
           MyWrkSht.Cells(LastRow + 1, 5).Value = ActiveWorkbook.Worksheets("ShipsDB").Cells(MyVarA, 9).Value

       End If
       MyWrkSht.Cells(LastRow + 1, 6).Value = "DAMAGED"
       If Len(Month(RowA)) < 2 Then
           ss = Year(RowA) & "/0" & Month(RowA)
       Else: ss = Year(RowA) & "/" & Month(RowA)
       End If
       MyWrkSht.Cells(LastRow + 1, 7).Value = ss
      
   End If


Set MyRange = Nothing
Set MyWrkSht = Nothing

End Sub


Here is the debug dialouge




cantona2 -> RE: Submarine Reporter for Excel 2010 BETA (10/8/2011 4:43:01 PM)

There is no file with that name in the scen folder of my AE install. I am running the latest official patch.




rcm1616 -> RE: Submarine Reporter for Excel 2010 BETA (10/8/2011 4:50:23 PM)

MY MISTAKE!

I use witploadae version dated 24.7.2011. In this version is new export option /b which enables choosing other delimiter character then ";". Without this new feature I was not able to import data from csv file to excel correctly.

So witploadae.exe from BETA version of GAME must be in \SCEN folder.




cantona2 -> RE: Submarine Reporter for Excel 2010 BETA (10/8/2011 4:53:10 PM)

Do i just need the witploadae BETA or i need to upgrade to Beta patch fully?




cantona2 -> RE: Submarine Reporter for Excel 2010 BETA (10/8/2011 4:55:42 PM)

I have had a look in the Scen folders of both installs of AE I have and there are no CSV files in any of them!?!?!?!




rcm1616 -> RE: Submarine Reporter for Excel 2010 BETA (10/8/2011 5:07:33 PM)


quote:

ORIGINAL: cantona2

Do i just need the witploadae BETA or i need to upgrade to Beta patch fully?


You just need to copy this file to SCEN folder. (and don't forget to rename or copy somewhere else old version)






Dan Nichols -> RE: Submarine Reporter for Excel 2010 BETA (10/8/2011 5:09:04 PM)

Here is what the dumpscen.bat file looks like:

c:
cd D:\War in the Pacific Admiral's Edition\PBEM game vs obvert\SCEN
witploadAE.exe/s002 /e /b,


when I run it I get this:


D:\War in the Pacific Admiral's Edition\PBEM game vs obvert\SCEN>c:

C:\>cd D:\War in the Pacific Admiral's Edition\PBEM game vs obvert\SCEN

C:\>witploadAE.exe/s002 /e /b,
'witploadAE.exe' is not recognized as an internal or external command,
operable program or batch file.

C:\>pause
Press any key to continue . . .

I think you need to put " around the file name.
and you are not handling the case where we have the game
installed to a disk other than c:


I changed my dumpscen.bat file to this and it extracted the files

d:
cd "D:\War in the Pacific Admiral's Edition\PBEM game vs obvert\SCEN"
witploadAE.exe/s002 /e /b,
pause

It does work on my 2007 excel.




rcm1616 -> RE: Submarine Reporter for Excel 2010 BETA (10/8/2011 5:18:07 PM)


quote:

ORIGINAL: Dan Nichols

Here is what the dumpscen.bat file looks like:

c:
cd D:\War in the Pacific Admiral's Edition\PBEM game vs obvert\SCEN
witploadAE.exe/s002 /e /b,


when I run it I get this:


D:\War in the Pacific Admiral's Edition\PBEM game vs obvert\SCEN>c:

C:\>cd D:\War in the Pacific Admiral's Edition\PBEM game vs obvert\SCEN

C:\>witploadAE.exe/s002 /e /b,
'witploadAE.exe' is not recognized as an internal or external command,
operable program or batch file.

C:\>pause
Press any key to continue . . .

I think you need to put " around the file name.
and you are not handling the case where we have the game
installed to a disk other than c:


I changed my dumpscen.bat file to this and it extracted the files

d:
cd "D:\War in the Pacific Admiral's Edition\PBEM game vs obvert\SCEN"
witploadAE.exe/s002 /e /b,
pause


Yeah. It looks like bug. I must fix it in next version.

Many thanks Dan





cantona2 -> RE: Submarine Reporter for Excel 2010 BETA (10/8/2011 5:28:08 PM)

OK, tried it with new beta and dumping started but there are no changes to the excel sheet, it stays exactly the same, ie with the same data that i downloaded it with




rcm1616 -> RE: Submarine Reporter for Excel 2010 BETA (10/8/2011 5:47:40 PM)

quote:

ORIGINAL: cantona2

OK, tried it with new beta and dumping started but there are no changes to the excel sheet, it stays exactly the same, ie with the same data that i downloaded it with


I left in ShipDB sheet data from scenario 1 in first version of file.
If you're importing scen 1 or 2, data in ShipDB must be same.

If you have version downloaded from Damien site you may have some forgotten data in Combat Reports sheet. Just delete all rows in Combat Reports sheet starting with second one (headings must stay intact)

Then you can import your own combatreports.




SgtSwanson -> RE: Submarine Reporter for Excel 2010 BETA (10/8/2011 6:49:38 PM)

This is NOT a hit on you rcm, just letting everyone else know that Excel Starter will not run the spreadsheet because macros are disabled with the free version that comes on most windows computers now.[:@][:@]




Pascal_slith -> RE: Submarine Reporter for Excel 2010 BETA (10/8/2011 7:10:14 PM)

You're much better off developing this in Excel 2003. I've encountered few people that have 2007 or 2010 (and lots of complaints about the last two).




rcm1616 -> RE: Submarine Reporter for Excel 2010 BETA (10/8/2011 7:15:22 PM)


quote:

ORIGINAL: SgtSwanson

This is NOT a hit on you rcm, just letting everyone else know that Excel Starter will not run the spreadsheet because macros are disabled with the free version that comes on most windows computers now.[:@][:@]


So it look like another reason to make version 2 on other (more platform independent) technology. My first plan was just make small reporting tool for myself. Sharing it with others came in second wave...

personal question: is 502nd IR in Berlin Brigade same 502nd regiment as in 101st Airborne? I never know, that Screaming Eagles had station in Berlin.




felix83 -> RE: Submarine Reporter for Excel 2010 BETA (10/8/2011 8:17:26 PM)

Dear rcm1616,
I highly appreciate Your work, but I am are disappointed we can not use it. [:(]
I like the idea as much as your intention to share it with the rest. Please don't feel disregarded by (at least) my comment: "cannot use it."
As I am mostley  a lurker You are propably in one of the most fair forums I am on.




JeffroK -> RE: Submarine Reporter for Excel 2010 BETA (10/8/2011 10:05:38 PM)

rcm1616

keep working, excellent tool and there must be a solution

Concurrent with the reflagging within the 101st, the 4th, 5th and 6th Battalions, 502nd Infantry were activated within the BERLIN BRIGADE by reflagging the existing 2nd, 3rd and 4th Battalions, 6th Infantry. This was part of a wider Army plan to regimentally pair units based within the United States with those stationed overseas for battalion rotational purposes. These three battalions, perpetuating the lineages of World War II Companies D, E and F, 502PIR, were neither Airborne nor Air Assault and were inactivated in the drawdown of the early 1990s. The rotation plan was found to be unworkable and was quietly abandoned.


Lost its Parachute rating around the late 50's and became an Air Assault Regiment when helicopters came into vogue




SgtSwanson -> RE: Submarine Reporter for Excel 2010 BETA (10/9/2011 11:03:59 AM)

quote:

personal question: is 502nd IR in Berlin Brigade same 502nd regiment as in 101st Airborne? I never know, that Screaming Eagles had station in Berlin.


JeffK's answer is absolutely correct. And yes I was. It also helped with personnel transfers. If the parent unit was full for a particular MOS (type of Job), at your current rank, then you would go into general circulation. Being Infantry, my slot at just about any rank up to E-6(SSG)went to the 101st first or the 82nd if you already had jump wings. During the late 70's early 80's the plan was to keep the following units at 90% wartime strength (100% peacetime)at all times because they were the primary QRF (Quick Reaction Force) of the Army.

75th Inf Regt. (Rangers) kept a company on QRF EVERY single day during this time.
82nd Airborne Div. (Parachute type ops)
101st Airborne Div. (Heli ops)
10th Mountian Div. (Light Inf)
24th Inf. Div. (light Inf) Mainly for Pacific crises
7th Inf. Div. (Light Inf.)

The Army also set up almost all personnel rotations, a.k.a. PCS moves in 6 month blocks. So, every 6 months a Regt. / BDE would loose / gain around 25-30%.

One of the reasons it was dropped was because, instead of taking a week to 10 days to get the entire 82nd over to Saudi Arabia for Desert Shield in Aug. 90, it took 32 days before the last man arrived. The first elements of the first Mech Div. started arriving a week later on RO-ROs. The Army never did a full alert cycle (moving an entire Division)in training. So we found out the hard way at a bad time, that it was severly flawed. And the main reason was the Wall fell in Nov. 89. The system was part of the REFORGER plan for a Russian invasion of Germany.

Last note: Our patch was the old SHEAF patch with the sword in flames in the middle with Berlin in the crest instead of SHEAF.

Links for the Berlin Brgade:
http://www.berlinbrigade.com/index.html
http://www.berlin-brigade.de/




bk19@mweb.co.za -> RE: Submarine Reporter for Excel 2010 BETA (10/9/2011 2:52:52 PM)


quote:

ORIGINAL: cantona2

I cant get this to work at all rcm1616

Do i need witpaeload running before I can use it? I use Tracker not witpaeload.
What happens if i have several games running from the same Save folder?



This unlikely to be the problem. It appears that the original code was written for use in east Europe. This guessed from the fact that the comments in the code appears to be Czech.

The following code block changes seem to get it to complete processing a single days operation and combat results files.

Function GetSunkShipDate(ShipLine) As Date
Dim sDate As String
Dim s, sDay, sMonth, sYear As String

    sDate = Right(ShipLine, 12)
    sYear = Right(sDate, 4)
    sDay = Mid(sDate, 5, 2)
    sMonth = GetMonth(Left(sDate, 3))
'   s = sDay + "." + sMonth + "." + sYear
    s = sDay + "/" + sMonth + "/" + sYear
    GetSunkShipDate = DateValue(s)

End Function

and

Function GetDayDate(DateLine As String) As Date
Dim LineL As Integer
Dim s, sMonth, sDay, sYear As String

    LineL = Len(DateLine)
    s = Mid(DateLine, LineL - 9, 10)
    sMonth = GetMonth(Mid(s, 1, 3))
    sDay = Mid(s, 5, 2)
    sYear = Mid(s, 9, 2)
'   s = sDay + "." + sMonth + "." + "19" + sYear
    s = sDay + "/" + sMonth + "/" + "19" + sYear
    GetDayDate = DateValue(s)

End Function


The reader will note that the date separator '.' should be the '/' separator in areas such as the UK and USA.
This is also an inelegant hack and thus needs work to do some localisation checks to determine the correct separator.

I have reported this now, mostly because I am still in the process of debugging it.




bk19@mweb.co.za -> RE: Submarine Reporter for Excel 2010 BETA (10/9/2011 2:56:54 PM)


quote:

ORIGINAL: SgtSwanson

This is NOT a hit on you rcm, just letting everyone else know that Excel Starter will not run the spreadsheet because macros are disabled with the free version that comes on most windows computers now.[:@][:@]


Macros are disabled in the general case as a mechanism to allow the user to protect him/herself from malicious code.

When the spreadsheet is loaded (in the newer versions) a toolbar option becomes available to enable the macro. This is a once off choice and must be immediately enabled before doing anything else. It is also possible to set the directory where this spreadsheet is stored to be a 'safe' source of spreadsheets and then macros will automatically be enabled.

I can't quite remember the mechanism for the older Excel application, but a similar option definately exists to enable macros in the spreadsheet. You will need to hunt around for it a bit.




bk19@mweb.co.za -> RE: Submarine Reporter for Excel 2010 BETA (10/9/2011 3:03:04 PM)

quote:

ORIGINAL: rcm1616

MY MISTAKE!

I use witploadae version dated 24.7.2011. In this version is new export option /b which enables choosing other delimiter character then ";". Without this new feature I was not able to import data from csv file to excel correctly.

So witploadae.exe from BETA version of GAME must be in \SCEN folder.


Are you sure?

I had absolutely no problem parsing the database files using witploadAE.exe date November 17th, 2009 03:48:42. This I know for sure is the last version available after the last official patch was installed. To be precise... there are no beta installs in the current directory tree where I am testing your software.

EDIT: Belay that question. It seems that the csv files loaded preceded the run date of your tool. I will report back after further investigation... sorry....






PaxMondo -> RE: Submarine Reporter for Excel 2010 BETA (10/9/2011 3:06:06 PM)


quote:

ORIGINAL: bk19@mweb.co.za


quote:

ORIGINAL: SgtSwanson

This is NOT a hit on you rcm, just letting everyone else know that Excel Starter will not run the spreadsheet because macros are disabled with the free version that comes on most windows computers now.[:@][:@]


Macros are disabled in the general case as a mechanism to allow the user to protect him/herself from malicious code.

When the spreadsheet is loaded (in the newer versions) a toolbar option becomes available to enable the macro. This is a once off choice and must be immediately enabled before doing anything else. It is also possible to set the directory where this spreadsheet is stored to be a 'safe' source of spreadsheets and then macros will automatically be enabled.

I can't quite remember the mechanism for the older Excel application, but a similar option definately exists to enable macros in the spreadsheet. You will need to hunt around for it a bit.


Under options. deep in the developer tab IIRC.




PaxMondo -> RE: Submarine Reporter for Excel 2010 BETA (10/9/2011 6:12:02 PM)


quote:

ORIGINAL: bk19@mweb.co.za
This unlikely to be the problem. It appears that the original code was written for use in east Europe.

Agreed. I had to repair the same two routines as you did to get the date/time standard aligned correctly so it would find the right file name. Initially it was looking for CombatReport2.txt for me.... [:D]




rcm1616 -> RE: Submarine Reporter for Excel 2010 BETA (10/9/2011 7:53:58 PM)


quote:

ORIGINAL: bk19@mweb.co.za

quote:

ORIGINAL: rcm1616

MY MISTAKE!

I use witploadae version dated 24.7.2011. In this version is new export option /b which enables choosing other delimiter character then ";". Without this new feature I was not able to import data from csv file to excel correctly.

So witploadae.exe from BETA version of GAME must be in \SCEN folder.


Are you sure?

I had absolutely no problem parsing the database files using witploadAE.exe date November 17th, 2009 03:48:42. This I know for sure is the last version available after the last official patch was installed. To be precise... there are no beta installs in the current directory tree where I am testing your software.

EDIT: Belay that question. It seems that the csv files loaded preceded the run date of your tool. I will report back after further investigation... sorry....




Yes, I WAS sure. Because I've tested it just before. My version of EXCEL, didn't import any data from csv created with official version of witploadae. I have no idea why. May be there are some slight differences between excel version (language versions, or US and NON US version...)




rcm1616 -> RE: Submarine Reporter for Excel 2010 BETA (10/9/2011 8:01:21 PM)


quote:

ORIGINAL: PaxMondo


quote:

ORIGINAL: bk19@mweb.co.za
This unlikely to be the problem. It appears that the original code was written for use in east Europe.

Agreed. I had to repair the same two routines as you did to get the date/time standard aligned correctly so it would find the right file name. Initially it was looking for CombatReport2.txt for me.... [:D]


Mhm. In my language setting (slovak locale set) I'm able to write date in any form. (incl.US/UK s DD/MM/YY).
It seems, US version is not able to work with other then US/UK standard. OK, I can fix it. From now I will use only US standard...




Page: [1] 2 3 4   next >   >>

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
1.796875