Question : After Excel export and format can I auto email?

I have an Access 2000 database that exports, then formats 3 reports for 166 Departments.
The file names export like so, with the department number as the first part of the file name.
This works great. Now I want to be able to email the reports to the appropriate departments. I am not sure if this can be done.

0001 - July Anniversary Report.xls
0001 - July Birthday Report.xls
0001 - July Performance Report.xls

It would be great to have them email together, but separate would be fine. Anything not to have to manually send 166 emails.

email addresses for Department 0001 is [email protected]; [email protected]

The code below is for the first export, the other 2 are the same except for the file name and the query name.

Any help is greatly appreciated. Thank you.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
Private Sub Command0_Click()
  On Error GoTo Err_Command0_Click
 
Dim rst As DAO.Recordset
Dim Path As String
Dim StrBU As String
Dim intDcode As String
Dim strQry As String
Dim StrExt As String
Dim strFile As String
Dim qDef As DAO.QueryDef
Dim oXL As Object
Dim oWB As Object
Dim oWS As Object
Set oXL = CreateObject("Excel.Application")
oXL.DisplayAlerts = False
Dim strContents
 
Err.Clear
On Error Resume Next
Set qDef = CurrentDb.QueryDefs("Anniversary Report")
If Err.Number <> 0 Then Set qDef = CurrentDb.CreateQueryDef("Anniversary Report")
On Error GoTo 0
 
strQry = "SELECT Departments1.[DeptNum],Departments1.[RestNumbertext]FROM Departments1 ORDER BY Departments1.[DeptNum];"
Set rst = CurrentDb().OpenRecordset(strQry, dbOpenDynaset)
rst.MoveLast
rst.MoveFirst
 
Do While Not rst.EOF
Path = "C:\Documents and Settings\Name\My Documents\Restaurant Monthly Reports\"
StrBU = rst("RestNumbertext")
StrExt = RestNumber & " - July Anniversary Report" & ".xls"
strFile = Path & StrBU & StrExt
intDcode = rst("DeptNum")
qDef.SQL = "SELECT * FROM QryAnniversaryReport WHERE DeptNum = " & intDcode & ""
 
DoCmd.OutputTo acOutputQuery, "Anniversary Report", acFormatXLS, strFile, False


Set oWB = oXL.Workbooks.Open(strFile)
Set oWS = oWB.Sheets(1)
oWS.Cells.Font.Name = "Times New Roman"
oWS.Cells.Font.Size = 10
oWS.Rows(1).Font.Bold = True
oWS.Columns("A:Z").AutoFit
oWS.Columns("C").HorizontalAlignment = -4108
oWS.Columns("E").HorizontalAlignment = -4108
oWS.Columns("G:K").HorizontalAlignment = -4108
oWS.Columns("H").NumberFormat = "mm/dd/yyyy"
oWS.PageSetup.TopMargin = 0.2
oWS.PageSetup.RightMargin = 0.2
oWS.PageSetup.LeftMargin = 0.2
oWS.PageSetup.BottomMargin = 0.2
oWS.PageSetup.Orientation = 2
oWS.PageSetup.Zoom = False
oWS.PageSetup.FitToPagesWide = 1
oWS.PageSetup.FitToPagesTall = 1

oWB.Save
oWB.Close
Set oWB = Nothing

rst.MoveNext
Loop
 
MsgBox ("Export Complete")
Set rst = Nothing
 
Exit_Command0_Click:
    Exit Sub
 
Err_Command0_Click:
    MsgBox Err.Description
    Resume Exit_Command0_Click
    
End Sub

Answer : After Excel export and format can I auto email?

Personally I'd abort HDD Regen -- if it hasn't made more progress in 31 hours it's not likely to have any notable success with that drive.

I'd start experimenting with partitions -- create a 44GB one to start, then see if it formats okay.

If so, then create a 10GB "BadArea1" partition (but don't format it);  and then a 3rd partition that uses the rest of the disk.    If the 3rd partition formats okay, you're done unless you want to experiment with just how big "BadArea1" needs to be.     If that's the case, delete the 3rd partition and delete BadArea1;  re-create a "BadArea1" partition but make it smaller (perhaps 5GB);  then make another partition after it and see if it formats okay.    You can repeat this process until you isolate just how big "BadArea1" has to be.

If you map out the area with physically damaged sectors, it's not likely to spread to the other partitions as long as they're not on the same physical cylinder -- which is VERY unlikely unless your "BadArea1" partition was exactly the right size down to the last actual sector (almost impossible).
Random Solutions  
 
programming4us programming4us