ok i have asked this once before but i seem to lost that thread so here goes again:
I need to export the contents of a datagrid/dbgrid to excel, does anyone know how to do this quick (without having to loop thru the rows and cols)?
Printable View
ok i have asked this once before but i seem to lost that thread so here goes again:
I need to export the contents of a datagrid/dbgrid to excel, does anyone know how to do this quick (without having to loop thru the rows and cols)?
This is what i used once in a project i hope it is usefull
Dim FS
Dim Book
'set up dialog box
Dialog.Flags = &H4006
Dialog.DialogTitle = DialogTitle.Caption
Dialog.CancelError = True
Dialog.InitDir = "C:\"
Dialog.DefaultExt = "csv"
Dialog.ShowSave
FS = ";"
Open Dialog.FileName For Output Shared As #1
Print #1, "DATA"
With Data1.Recordset
Book = .Bookmark
.MoveFirst
Do Until .EOF
Print #1, !Field1; FS; !Field2
.MoveNext
Loop
.Bookmark = Book
End With
Close 1
ASTERIX