Advertisement
| 02.14.2008 at 10:29AM PST, ID: 23163861 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. 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: |
Public Sub Export_Excel()
Dim oApp As excel.Application
Dim owb As excel.Workbook
Dim i As Integer
Dim dbs As DAO.Database
Dim RS As DAO.Recordset
Dim SQL As String
'Create an instance of Excel and add a new blank workbook
SQL = "SELECT * FROM [tbl_found]"
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(SQL, dbOpenSnapshot)
Set oApp = New excel.Application
oApp.Visible = False
Set owb = oApp.Workbooks.Add
'Add the field names as column headers (optional)
For i = 0 To rst.Fields.Count - 1
owb.Sheets(1).Cells(1, i + 1).Value = rst.Fields(i).Name
Next
owb.Sheets(1).Range("1:1").Font.Bold = True
owb.Sheets(1).Cells(2, 1).CopyFromRecordset rst
'Clean up ADO Objects
RS.Close
Set RS = Nothing
'Create a folder if not exist
Dim strFilePath As String
Dim strFolder As String
strFolder = "C:\Documents and Settings"
strFilePath = strFolder & "\MTO_" & Format(Now(), "yyyymmdd_HHmmss") & ".xls"
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FolderExists(strFolder) Then
'Create the file
FileSystem.MkDir (strFolder)
End If
'Clean up Excel Objects
owb.Close SaveChanges:=True, Filename:=strFilePath
Set owb = Nothing
oApp.Quit
Set oApp = Nothing
End Sub
|
Advertisement