View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Peter Rooney Peter Rooney is offline
external usenet poster
 
Posts: 325
Default Macro creates additional datafiles when saving copies of workbook

Good morning, all!

I am using a simple loop to create test data workbooks. There is a 5X1 range
"DropDownTeams" which is referred to as "TestDataCell" - the cells contain
ELS1, ELS2...ELS5.

My macro successfully creates the following workbooks:
D:\Pete's Operations\Personal\Test\SOFT Report - 0530 - ELS1.xls
D:\Pete's Operations\Personal\Test\SOFT Report - 0530 - ELS2.xls
D:\Pete's Operations\Personal\Test\SOFT Report - 0530 - ELS3.xls
D:\Pete's Operations\Personal\Test\SOFT Report - 0530 - ELS4.xls
D:\Pete's Operations\Personal\Test\SOFT Report - 0530 - ELS5.xls

the "0530" being the contents of two additional variables generated by the
macro YearWeekResourceName. However, I ALSO get five additional files
created, the same size as the original workbook, with no file extension and a
filename made up of 8 random alphanumeric characters.

Can anyone suggest why these files are being created? Are they temp files,
and, if this is the case, why aren't they being deleted?

Thanks in advance

Pete




Sub SetTestFolderName()
TestFolderName = "D:\Pete's operations\Personal\Test\"
End Sub

Sub TestDataTeam()
For Each TestDataCell In Sheets("DropDownLists").Range("DropDownTeams")
Sheets("Database").Range("HeaderRemarks").Offset(1 , 0).Value =
TestDataCell.Value
Sheets("Database").Range("HeaderSubTeam").Offset(1 , 0).Value = ""
SaveTestData
Next
End Sub

Sub SaveTestData()
SetTestFolderName
DefineDatabase
YearWeekResourceName
'Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=TestFolderName & Year & "-" & WeekNumber
& _
" - SOFT Report - " & TestDataCell.Value & ".xls", _
FileFormat:=xlExcel9795, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub