hallo…
kann mir wer nen tip gegen,
wie ich abschecken kann wo sich der ordner xlstart befindet?
vieen dank
gruß
h.
Hi h.,
wie wäre es mit Start -> Suchen -> Dateien/Ordner -> Name: xlstart? Bei mir ist es unter c:\programme\microsoft office\office.
Oder willst Du das mit VB machen??
Gru
Sculpture
hi hi, wie lustig )
hallo sculpture…
ich wollte das schon in faubeh machen…
beste grüße
herpes
[Bei dieser Antwort wurde das Vollzitat nachträglich automatisiert entfernt]
hmmmm
hi
ich hab zwar kein „xlstart“ aber wenn dieser ordner so wichtig ist dann wird er vermutlich irgendow in der registry drinstehn (suchen mit regedit) und dann kannst dus ja mit getsettings auslesen
hoffe es hilft
mfg Luemmel
xlstart ist der startordner von m$ ätzel
tach luemmel
also wie gesagt xlsatr ist der startordner für excel…
wenn du kein excel aufm rechner hast kannste den ordner auch nich haben…
das mit der regis´try auslesen klinkt allerdings interessant…
aber iw e lese ich die registry per vb aus und bekmomme den pfad zurück? mit getsettings, okay…
hast dun beispiel?
thängs
[Bei dieser Antwort wurde das Vollzitat nachträglich automatisiert entfernt]
hi
ne hab ich leider nicht ich hab den befehl noch nie gebraucht
das sieht aber laut quickinfo recht einfach aus:
GetSettings AppName, Section, Key
(wenns nich funzt kannst du das ja als nächste frage stellen)
ich schätze es reicht wenn du herausfindest unter welchem key der ordner in der registry gespeichert ist
mfg Luemmel
Hier der Code für die Registry. Erstelle eine neue Klasse und kopiere diesen Code hinein.
Option Explicit
'Registry Constants
Public Enum EHKey_Base
HKEY_CLASSES_ROOT = &H80000000
HKEY_CURRENT_USER = &H80000001
HKEY_LOCAL_MACHINE = &H80000002
HKEY_USERS = &H80000003
End Enum
'Registry Specific Access Rights
Private Enum EHKey_Access
KEY_QUERY_VALUE = &H1
KEY_SET_VALUE = &H2
KEY_CREATE_SUB_KEY = &H4
KEY_ENUMERATE_SUB_KEYS = &H8
KEY_NOTIFY = &H10
KEY_CREATE_LINK = &H20
KEY_ALL_ACCESS = &H3F
End Enum
'Open/Create Options
Private Const REG_OPTION_NON_VOLATILE = 0&
Private Const REG_OPTION_VOLATILE = &H1
'Key creation/open disposition
Private Const REG_CREATED_NEW_KEY = &H1
Private Const REG_OPENED_EXISTING_KEY = &H2
'masks for the predefined standard access types
Private Const STANDARD_RIGHTS_ALL = &H1F0000
Private Const SPECIFIC_RIGHTS_ALL = &HFFFF
'Define severity codes
Private Const ERROR_SUCCESS = 0&
Private Const ERROR_ACCESS_DENIED = 5
Private Const ERROR_NO_MORE_ITEMS = 259
'Predefined Value Types
Private Const REG_NONE = (0) 'No value type
Private Const REG_SZ = (1) 'Unicode nul terminated string
Private Const REG_EXPAND_SZ = (2) 'Unicode nul terminated string w/enviornment var
Private Const REG_BINARY = (3) 'Free form binary
Private Const REG_DWORD = (4) '32-bit number
Private Const REG_DWORD_LITTLE_ENDIAN = (4) '32-bit number (same as REG_DWORD)
Private Const REG_DWORD_BIG_ENDIAN = (5) '32-bit number
Private Const REG_LINK = (6) 'Symbolic Link (unicode)
Private Const REG_MULTI_SZ = (7) 'Multiple Unicode strings
Private Const REG_RESOURCE_LIST = (8) 'Resource list in the resource map
Private Const REG_FULL_RESOURCE_DESCRIPTOR = (9) 'Resource list in the hardware description
Private Const REG_RESOURCE_REQUIREMENTS_LIST = (10)
'Structures Needed For Registry Prototypes
Private Type typSecurityAttributes
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Boolean
End Type
Private Type typFileTime
dwLowDateTime As Long
dwHighDateTime As Long
End Type
'Registry Function Prototypes
Private Declare Function RegOpenKeyEx Lib „advapi32“ Alias „RegOpenKeyExA“ (ByVal lngHKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
Private Declare Function RegSetValueEx Lib „advapi32“ Alias „RegSetValueExA“ (ByVal lngHKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByVal szData As String, ByVal cbData As Long) As Long
Private Declare Function RegCloseKey Lib „advapi32“ (ByVal lngHKey As Long) As Long
Private Declare Function RegQueryValueEx Lib „advapi32“ Alias „RegQueryValueExA“ (ByVal lngHKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, ByRef lpType As Long, ByVal szData As String, ByRef lpcbData As Long) As Long
Private Declare Function RegCreateKeyEx Lib „advapi32“ Alias „RegCreateKeyExA“ (ByVal lngHKey As Long, ByVal lpSubKey As String, ByVal Reserved As Long, ByVal lpClass As String, ByVal dwOptions As Long, ByVal samDesired As Long, lpSecurityAttributes As typSecurityAttributes, phkResult As Long, lpdwDisposition As Long) As Long
Private Declare Function RegEnumKeyEx Lib „advapi32.dll“ Alias „RegEnumKeyExA“ (ByVal lngHKey As Long, ByVal dwIndex As Long, ByVal lpName As String, lpcbName As Long, ByVal lpReserved As Long, ByVal lpClass As String, lpcbClass As Long, lpftLastWriteTime As typFileTime) As Long
Private Declare Function RegEnumValue Lib „advapi32.dll“ Alias „RegEnumValueA“ (ByVal lngHKey As Long, ByVal dwIndex As Long, ByVal lpValueName As String, lpcbValueName As Long, ByVal lpReserved As Long, lpType As Long, ByVal lpData As String, lpcbData As Long) As Long
Private Declare Function RegDeleteKey Lib „advapi32.dll“ Alias „RegDeleteKeyA“ (ByVal lngHKey As Long, ByVal lpSubKey As String) As Long
Private Declare Function RegDeleteValue Lib „advapi32.dll“ Alias „RegDeleteValueA“ (ByVal lngHKey As Long, ByVal lpValueName As String) As Long
Private meHKey As EHKey_Base
Private mstrSubKey As String
Private mstrValueName As String
Public newSubKey As String
Public keyCreated As Boolean
Public Value As String
Public StartValue As String
Public Property Let HKey(ByVal Value As EHKey_Base)
meHKey = Value
End Property
Public Property Get HKey() As EHKey_Base
HKey = meHKey
End Property
Public Property Let SubKey(ByVal Value As String)
mstrSubKey = Value
End Property
Public Property Get SubKey() As String
SubKey = mstrSubKey
End Property
Public Property Get ValueName() As String
ValueName = mstrValueName
End Property
Public Property Let ValueName(strNew As String)
mstrValueName = strNew
End Property
Public Function GetRegValue(Optional ValueName As Variant) As String
If IsNull(meHKey) Then
meHKey = HKEY_LOCAL_MACHINE
Else
If meHKey = 0 Then meHKey = HKEY_LOCAL_MACHINE
End If
StartValue = „“
If IsMissing(ValueName) Then
GetRegValue = GetRegValueEx
Else
GetRegValue = GetRegValueEx(ValueName)
End If
End Function
Public Function SetRegValue(Optional ValueName As Variant) As Boolean
If IsNull(meHKey) Then
meHKey = HKEY_LOCAL_MACHINE
Else
If meHKey = 0 Then meHKey = HKEY_LOCAL_MACHINE
End If
If IsMissing(ValueName) Then
SetRegValue = SetRegValueEx
Else
SetRegValue = SetRegValueEx(ValueName)
End If
End Function
Public Function CreateRegKey() As Boolean
Dim phkResult As Long
Dim SA As typSecurityAttributes
Dim lngCreate As Long
Dim strWholeSubKey As String
Dim blnResult As Boolean
On Error GoTo ErrorHandler
If mstrSubKey „“ Then
If (Right(mstrSubKey, 1) = „“) Or (Left(newSubKey, 1) = „“) Then
strWholeSubKey = mstrSubKey & newSubKey
Else
strWholeSubKey = mstrSubKey & „“ & newSubKey
End If
Else
strWholeSubKey = newSubKey
End If
'Create key if it does not exist
blnResult = (RegCreateKeyEx(meHKey, strWholeSubKey, 0, „“, REG_OPTION_NON_VOLATILE, _
KEY_ALL_ACCESS, SA, phkResult, lngCreate) = ERROR_SUCCESS)
If blnResult = True Then
If lngCreate = REG_CREATED_NEW_KEY Then
keyCreated = True
Else
keyCreated = False
End If
End If
'Close the key
RegCloseKey phkResult
ExitHandler:
CreateRegKey = blnResult
Exit Function
ErrorHandler:
’ StandardErrorMessage
blnResult = False
Resume ExitHandler
End Function
Public Function GetRegValueEx(Optional ValueName As Variant) As String
Dim phkResult As Long
Dim lResult As Long
Dim szBuffer As String
Dim lBuffSize As Long
Dim lpType As Long
'Dim blnResult As Boolean
Dim lngValue As Long
Dim b1 As Long, b2 As Long, b3 As Long, b4 As Long
On Error GoTo ErrorHandler
If Not IsMissing(ValueName) Then mstrValueName = CStr(ValueName)
'Create Buffer
szBuffer = Space(1023)
lBuffSize = Len(szBuffer)
'Open the key
lResult = RegOpenKeyEx(meHKey, mstrSubKey, 0, 1, phkResult)
If lResult ERROR_SUCCESS Then GoTo ErrorHandler
'Query the value
lResult = RegQueryValueEx(phkResult, mstrValueName, 0, lpType, szBuffer, lBuffSize)
’ Result 234 wird zurückgegeben, wenn der Wert nicht in den Buffer passt
If lResult = 234 Then
’ durch erneutes öffnen lässt sich jedoch ein korrekter Wert auslesen, der dann
’ aber auf die grösse von szBuffer und lBufferSize zugeschnitten wird
lResult = RegOpenKeyEx(meHKey, mstrSubKey, 0, 1, phkResult)
lResult = RegQueryValueEx(phkResult, mstrValueName, 0, lpType, szBuffer, lBuffSize)
End If
If lResult ERROR_SUCCESS Then GoTo ErrorHandler
'Close the key
RegCloseKey phkResult
'blnResult = True
If lpType = REG_SZ Then
Value = Left(szBuffer, lBuffSize - 1)
ElseIf lpType = REG_DWORD Then
b4 = Asc(Mid(szBuffer, 4, 1))
b3 = Asc(Mid(szBuffer, 3, 1))
b2 = Asc(Mid(szBuffer, 2, 1))
b1 = Asc(Mid(szBuffer, 1, 1))
lngValue = ((b3 * 256&:wink: + b2) * 256& + b1
If b4 >= 128 Then b4 = b4 - 256
lngValue = b4 * 256& * 256& * 256& + lngValue
Value = CStr(lngValue)
Else
Value = StartValue
'blnResult = False
End If
ExitHandler:
GetRegValueEx = Value
Exit Function
ErrorHandler:
'StandardErrorMessage
'blnResult = False
Value = StartValue
Resume ExitHandler
End Function
Public Function SetRegValueEx(Optional ValueName As Variant) As Boolean
Dim phkResult As Long
Dim lResult As Long
Dim SA As typSecurityAttributes
Dim lngCreate As Long
Dim blnResult As Boolean
On Error GoTo ErrorHandler
If Not IsMissing(ValueName) Then mstrValueName = CStr(ValueName)
'Note: This function will create the key or value if it doesn’t exist.
'Open or Create the key
lResult = RegCreateKeyEx(meHKey, mstrSubKey, 0, „“, REG_OPTION_NON_VOLATILE, _
KEY_ALL_ACCESS, SA, phkResult, lngCreate)
If lResult ERROR_SUCCESS Then GoTo ErrorHandler
lResult = RegSetValueEx(phkResult, mstrValueName, 0, REG_SZ, Value, _
CLng(Len(Value) + 1))
If lResult ERROR_SUCCESS Then GoTo ErrorHandler
'Close the key
RegCloseKey phkResult
blnResult = True
ExitHandler:
SetRegValueEx = blnResult
Exit Function
ErrorHandler:
’ StandardErrorMessage
blnResult = False
Resume ExitHandler
End Function
Public Function DelRegKey() As Boolean
Dim phkResult As Long
Dim lResult As Long
Dim SA As typSecurityAttributes
Dim lngCreate As Long
Dim blnResult As Boolean
On Error GoTo ErrorHandler
blnResult = False
RegCreateKeyEx meHKey, mstrSubKey, 0, „“, REG_OPTION_NON_VOLATILE, _
KEY_ALL_ACCESS, SA, phkResult, lngCreate
'Delete mstrSubKey specified
If RegDeleteKey(phkResult, „“) = ERROR_SUCCESS Then
blnResult = True
Else
blnResult = False
'Close the current mstrSubKey
RegCloseKey phkResult
End If
ExitHandler:
DelRegKey = blnResult
Exit Function
ErrorHandler:
’ StandardErrorMessage
Resume ExitHandler
End Function
oder so
HÖLLE! was mach ich denn damit???
danke für die hilfe…
muss allerdings gestehen das ich mit dem letzt gepostet code von
patrick nich so ganz klar komme…
also ich leg das inne klasse…
und wie führ ich das dann aus?
tschüssß
hep.
Der Code in einem Form oder Modul:
Dim objRegistry as New clsRegistry
Dim strValue as String
objRegistry.HKey = HKEY_LOCAL_MACHINE
objRegistry.SubKey = „SOFTWARE\Microsoft“
strValue = Registry.GetRegValueEx(„xy“)
clsRegistry ist Deine erstellte Klasse.
HKey ist der Hauptschlüssel
SubKey ist der unterschlüssel
xy ist der Wert den Du auslesen möchtest
vielen dank!
danke schööööhn
gruß
herps