Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro error please help
Hello
I am trying to use thi following macro but I get an error saing KERNEL cannot be found and this occurs at the macro line " y= ......" What I am doing wrong? I am Using WindowXP Professional and Excel 2003 'The following two declare statements need to be entered each on a single 'line in the module sheet. Declare Function GetSystemDirectory Lib "KERNEL" (ByVal lpBuffer As String, ByVal nSize As Integer) As Integer Declare Function GetWindowsDirectory Lib "KERNEL" (ByVal lpBuffer As String, ByVal nSize As Integer) As Integer Sub GetDir() 'sets the buffer length for both variables to 144 Dim Win_Dir As String * 144 Dim Sys_Dir As String * 144 'returns the \Windows directory y = GetWindowsDirectory(Win_Dir, Len(Win_Dir)) 'Displays the windows directory in a Message box MsgBox Win_Dir 'Returns the Windows\System directory x = GetSystemDirectory(Sys_Dir, Len(Win_Dir)) 'Displays the \Windows\System directory in a Message box MsgBox Sys_Dir End Sub thanks for the help Francesco |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro error please help
Declare Function GetSystemDirectory Lib "KERNEL32.DLL" Alias
"GetSystemDirectoryA" _ (ByVal lpBuffer As String, ByVal nSize As Integer) As Integer Declare Function GetWindowsDirectory Lib "KERNEL32.DLL" Alias "GetWindowsDirectoryA" _ (ByVal lpBuffer As String, ByVal nSize As Integer) As Integer HTH -- AP "Francesco" a écrit dans le message de ... Hello I am trying to use thi following macro but I get an error saing KERNEL cannot be found and this occurs at the macro line " y= ......" What I am doing wrong? I am Using WindowXP Professional and Excel 2003 'The following two declare statements need to be entered each on a single 'line in the module sheet. Declare Function GetSystemDirectory Lib "KERNEL" (ByVal lpBuffer As String, ByVal nSize As Integer) As Integer Declare Function GetWindowsDirectory Lib "KERNEL" (ByVal lpBuffer As String, ByVal nSize As Integer) As Integer Sub GetDir() 'sets the buffer length for both variables to 144 Dim Win_Dir As String * 144 Dim Sys_Dir As String * 144 'returns the \Windows directory y = GetWindowsDirectory(Win_Dir, Len(Win_Dir)) 'Displays the windows directory in a Message box MsgBox Win_Dir 'Returns the Windows\System directory x = GetSystemDirectory(Sys_Dir, Len(Win_Dir)) 'Displays the \Windows\System directory in a Message box MsgBox Sys_Dir End Sub thanks for the help Francesco |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Search, Copy, Paste Macro in Excel | Excel Worksheet Functions | |||
Closing File Error | Excel Discussion (Misc queries) | |||
macro with F9 | Excel Discussion (Misc queries) | |||
Make Alignment options under format cells available as shortcut | Excel Discussion (Misc queries) | |||
Playing a macro from another workbook | Excel Discussion (Misc queries) |