help with a function

J

Janis

I need help to make this function create an excel file. It would be helpful
also to get the data from the updated record into the sheet first. Thanks

Private Sub Form_AfterUpdate()
Const STRPATH = "c:\Test"
Const STRFILENAME = "Emp.xls"
Const OPEN_EXISTING = 3&
If Dir(STRPATH) = "" Then
' Create directory

Else
If STRPATH & "\" & STRFILENAME = "" Then


CreateFile(STRPATH, 0, 0, ByVal 0&, OPEN_EXISTING, 0, ByVal 0&) =
Me.xlsOutput.worksheets("Emp.xls")

End If


End Sub

Private Declare Function CreateFile& Lib "kernel32" Alias "CreateFileA"
(ByVal STRPATH As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As
Long, lpSecurityAttributes As Any, ByVal dwCreationDisposition As Long, ByVal
dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long)
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top