J
Janis
I have a couple questions: First, there is a syntax error on the createFile
line???? What I want to do is create an Excel file.
The second question is how do you create a directory?
Please help
Thanks,
Janis
--------------code---------------
Option Compare Database
Option Explicit
Private Sub Form_AfterUpdate()
strPath = "c:\Test"
strFileName = "Emp.xls"
If Dir(strPath) = "" Then
' Create directory
Else
If strPath & "\" & strFileName = "" Then
'Create spreadsheet
CreateFile(strPath, 0, 0, ByVal 0&, OPEN_EXISTING, 0, ByVal 0&)
End If
End Sub
Private Declare Function CreateFile& Lib "kernel32" Alias "CreateFileA"
(ByVal _
lpFileName 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)
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long)
As Long
line???? What I want to do is create an Excel file.
The second question is how do you create a directory?
Please help
Thanks,
Janis
--------------code---------------
Option Compare Database
Option Explicit
Private Sub Form_AfterUpdate()
strPath = "c:\Test"
strFileName = "Emp.xls"
If Dir(strPath) = "" Then
' Create directory
Else
If strPath & "\" & strFileName = "" Then
'Create spreadsheet
CreateFile(strPath, 0, 0, ByVal 0&, OPEN_EXISTING, 0, ByVal 0&)
End If
End Sub
Private Declare Function CreateFile& Lib "kernel32" Alias "CreateFileA"
(ByVal _
lpFileName 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)
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long)
As Long