Why does Access care?
I thought that the second code formatted, saved and closed the text (.iif) file.
And once you save (and close) that workbook as a text file, there isn't a
worksheet anymore--it's just plain old text.
==
Since I'm obviously missing something basic, you could either use the copy to
new workbook and save from there or just rename the sheet after you do the save.
thisworkbook.saveas....
Thisworkbook.worksheets(1).name = "Sheet1"
(since there's only one sheet in the template.)
annep wrote:
I really like the button idea, didn't even know I could do that.
I am still trying to save the iif file with PostingSum & date.iif.
I put your codes together, but I again changes the sheet name to
PostingSum011706, but the sheet name needs to stay constant because
Access looks for the sheet name.
Any other ideas?
Anne
Sub doTheWork()
Dim sStr As String
Dim WorkbookCtr As Long
Dim wCtr As Long
Dim wkbk As Workbook
Const sDateCell As String = "c4"
sStr = Format(Range(sDateCell), "mmddyy")
Application.DisplayAlerts = False
ThisWorkbook.SaveAs Filename:="C:\Access\Postingsum" & sStr & ".iif",
_
FileFormat:=xlText, CreateBackup:=False
Application.DisplayAlerts = True
MsgBox "The Posting Summary for this week has been created, " & _
"Saving and closing Workbook"
If Workbooks.Count 1 Then
ThisWorkbook.Close savechanges:=False
Else
Application.DisplayAlerts = False
Application.Quit
End If
End Sub
--
annep
------------------------------------------------------------------------
annep's Profile: http://www.excelforum.com/member.php...o&userid=18851
View this thread: http://www.excelforum.com/showthread...hreadid=503559
--
Dave Peterson