TheAceMan1
Programmer
Howdy All! . . .
Platform: Vista Home Premium, Excel 2003 SP3
Have a routine in a workbook whose job it is to get the total count of the number of columns from a number of workbooks. The workbooks all reside in a specific folder and are duplicates of a master ... just different data. The structure of the workbook has a test procedure running down the left side and each column to right holds tester info on each step. Iknow ... I know ... not my design. Just helping a friend.
Anyway the code works fine and returns the proper counts. It'll be a single total count when I get out of the [blue]testing phase[/blue].
The problem: After opening and closing all these files (one by one), windows Task Manager reveals and additional XL file running with the same name as that the code is running in ... Acetest.xls.
Before running the code Task Manager reveals:
[purple]Microsoft Excel-AceTest.xls[/purple]
After the code runs its:
[red]AceTest.xls[/red]
[purple]Microsoft Excel-AceTest.xls[/purple]
I present the code below with a line highlited in [red]red[/red] to show where the additional Task Manager entry 1st appears ... after single stepping in debug mode:
Any Ideas how to get rid of the lingering task?
[blue]Your Thoughts? . . .[/blue]
See Ya! . . . . . .
Be sure to see thread181-473997 [blue]Worthy Reading![/blue]
Also faq181-2886 [blue]Worthy Reading![/blue]
Platform: Vista Home Premium, Excel 2003 SP3
Have a routine in a workbook whose job it is to get the total count of the number of columns from a number of workbooks. The workbooks all reside in a specific folder and are duplicates of a master ... just different data. The structure of the workbook has a test procedure running down the left side and each column to right holds tester info on each step. Iknow ... I know ... not my design. Just helping a friend.
Anyway the code works fine and returns the proper counts. It'll be a single total count when I get out of the [blue]testing phase[/blue].
The problem: After opening and closing all these files (one by one), windows Task Manager reveals and additional XL file running with the same name as that the code is running in ... Acetest.xls.
Before running the code Task Manager reveals:
[purple]Microsoft Excel-AceTest.xls[/purple]
After the code runs its:
[red]AceTest.xls[/red]
[purple]Microsoft Excel-AceTest.xls[/purple]
I present the code below with a line highlited in [red]red[/red] to show where the additional Task Manager entry 1st appears ... after single stepping in debug mode:
Code:
[blue][green]'Main Routine[/green]
Public Function AllWkBksTltBall()
Dim fPath As String, curName As String, cnt As Long
fPath = "C:\SpreadSheets\Ballast\"
curName = Dir(fPath & "*.xls")
cnt = WkBkTltBall()
Debug.Print ActiveWorkbook.Name & " " & cnt [green]'This WorkBook[/green]
Do Until curName = ""
[red][b]Workbooks.Open (fPath & curName)[/b][/red]
cnt = WkBkTltBall()
Debug.Print ActiveWorkbook.Name & " " & cnt [green]'File WorkBook[/green]
ActiveWorkbook.Close
curName = Dir
Loop
End Function
[green]'Support Routine[/green]
Public Function WkBkTltBall() As Long
Dim ws As Worksheet, idx As Long, Shts As String, Tlt As Long, WB As Workbook
Shts = "CtlData~Sample"
For Each ws In ActiveWorkbook.Worksheets
With ws
If InStr(Shts, ws.Name) = 0 Then
idx = .Cells(6, .Columns.Count).End(xlToLeft).Column
If idx = 8 Then idx = 6
Tlt = Tlt + (idx - 6) / 3
[green]'Debug.Print ws.Name & " " & (idx - 6) / 3[/green]
End If
End With
Next
WkBkTltBall = Tlt
End Function[/blue]
[blue]Your Thoughts? . . .[/blue]
See Ya! . . . . . .
Be sure to see thread181-473997 [blue]Worthy Reading![/blue]
Also faq181-2886 [blue]Worthy Reading![/blue]