Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Francesco
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.misc
Ardus Petus
 
Posts: n/a
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search, Copy, Paste Macro in Excel [email protected] Excel Worksheet Functions 0 January 3rd 06 06:51 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
macro with F9 Kenny Excel Discussion (Misc queries) 1 August 3rd 05 02:41 PM
Make Alignment options under format cells available as shortcut dforrest Excel Discussion (Misc queries) 1 July 14th 05 10:58 PM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM


All times are GMT +1. The time now is 10:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"