זה לא עוזר לי...
Sub ChangeCommentWith()
Dim myRegKey As String
Dim myValue As String
Dim myFileAs As String
Dim myAnswer As Integer
'get registry key to work with
myRegKey = "HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Common\MailSettings\MarkComments"
If myRegKey = "" Then Exit Sub
'check if key exists
If RegKeyExists(myRegKey) = True Then
'key exists, read it
myValue = RegKeyRead(myRegKey)
If myValue = 1 Then myValue = "0" Else myValue = 1
Else
myValue = 1
End If
If myValue <> "" Then
RegKeySave myRegKey, myValue
MsgBox "Registry key set to " & myValue
End If
End Sub
'reads the value for the registry key i_RegKey
'if the key cannot be found, the return value is ""
Function RegKeyRead(i_RegKey As String) As String
Dim myWS As Object
On Error Resume Next
'access Windows scripting
Set myWS = CreateObject("WScript.Shell")
'read key from registry
RegKeyRead = myWS.RegRead(i_RegKey)
End Function
'sets the registry key i_RegKey to the
'value i_Value with type i_Type
'if i_Type is omitted, the value will be saved as string
'if i_RegKey wasn't found, a new registry key will be created
' change REG_DWORD to the correct key type
Sub RegKeySave(i_RegKey As String, _
i_Value As String, _
Optional i_Type As String = "REG_DWORD")
Dim myWS As Object
'access Windows scripting
Set myWS = CreateObject("WScript.Shell")
'write registry key
myWS.RegWrite i_RegKey, i_Value, i_Type
End Sub
'returns True if the registry key i_RegKey was found
'and False if not
Function RegKeyExists(i_RegKey As String) As Boolean
Dim myWS As Object
On Error GoTo ErrorHandler
'access Windows scripting
Set myWS = CreateObject("WScript.Shell")
'try to read the registry key
myWS.RegRead i_RegKey
'key was found
RegKeyExists = True
Exit Function
ErrorHandler:
'key was not found
RegKeyExists = False
End Function
זה נראה עובד, אבל יש לך מושג איך אני גורם לקריקטוריון להיות נצרך שבלעדיו האקסס לא יעלה?תבדוק את זה:
קוד:Sub ChangeCommentWith() Dim myRegKey As String Dim myValue As String Dim myFileAs As String Dim myAnswer As Integer 'get registry key to work with myRegKey = "HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Common\MailSettings\MarkComments" If myRegKey = "" Then Exit Sub 'check if key exists If RegKeyExists(myRegKey) = True Then 'key exists, read it myValue = RegKeyRead(myRegKey) If myValue = 1 Then myValue = "0" Else myValue = 1 Else myValue = 1 End If If myValue <> "" Then RegKeySave myRegKey, myValue MsgBox "Registry key set to " & myValue End If End Sub 'reads the value for the registry key i_RegKey 'if the key cannot be found, the return value is "" Function RegKeyRead(i_RegKey As String) As String Dim myWS As Object On Error Resume Next 'access Windows scripting Set myWS = CreateObject("WScript.Shell") 'read key from registry RegKeyRead = myWS.RegRead(i_RegKey) End Function 'sets the registry key i_RegKey to the 'value i_Value with type i_Type 'if i_Type is omitted, the value will be saved as string 'if i_RegKey wasn't found, a new registry key will be created ' change REG_DWORD to the correct key type Sub RegKeySave(i_RegKey As String, _ i_Value As String, _ Optional i_Type As String = "REG_DWORD") Dim myWS As Object 'access Windows scripting Set myWS = CreateObject("WScript.Shell") 'write registry key myWS.RegWrite i_RegKey, i_Value, i_Type End Sub 'returns True if the registry key i_RegKey was found 'and False if not Function RegKeyExists(i_RegKey As String) As Boolean Dim myWS As Object On Error GoTo ErrorHandler 'access Windows scripting Set myWS = CreateObject("WScript.Shell") 'try to read the registry key myWS.RegRead i_RegKey 'key was found RegKeyExists = True Exit Function ErrorHandler: 'key was not found RegKeyExists = False End Function
מקור
הוא מסמן לי שגיאה:תוסיף אירוע בעת טעינה על הטופס הראשון שאתה פותח, שבודק את הנתון.
אם הוא שונה ממה שבא לך, שהקובץ ייסגר.
בס"ד
אני זקוק למודול באקסס שפתיחת הקובץ מבקש מהרגיסטרי נתונים
מי שיש לו כזה ויוכל להעביר לי את זה אני יודה לו מאד.
לוח לימודים
מסלולי לימוד שאפשר לההצטרף
אליהם ממש עכשיו:
2.04
כ"ג אדר ב'
השקה חגיגית
חדש בפרוג
קורס חדשנות AI ובינה מלאכותית
14 שיעורים מפוצצים תוכן על כלי הAI השונים ליצירת תמונות וויז'ואל, עריכת וידאו ומושן, כתיבה ורעיונות, אפיון ועיצוב אתרים ועוד המון!
ההרשמה נפתחה!
20.03
י' אדר ב'
פתיחת מסלול
עיצוב ואדריכלות פנים
מלגות גבוהות!
26.03
טז' אדר ב'
פתיחת מסלול
מאסטר בשיווק דיגיטלי
מלגות גבוהות!
8.05
ל' ניסן
פתיחת מסלול
אוטומציות עסקיות, בוטים והטמעת מערכות מידע
מלגות גבוהות!
9.05
א' אייר
ירושלמי?
יש לנו מלגה מטורפת עבורך! קורס במימון כמעט מלא!!
אוטומציות עסקיות, בוטים והטמעת מערכות מידע
ההרשמה בעיצומה
28.05
כ' אייר
פתיחת מסלול מורחב:
פיתוח ובניית אתרים
מלגות גבוהות!
תהילים פרק קיט ב'
ט בַּמֶּה יְזַכֶּה נַּעַר אֶת אָרְחוֹ לִשְׁמֹר כִּדְבָרֶךָ:י בְּכָל לִבִּי דְרַשְׁתִּיךָ אַל תַּשְׁגֵּנִי מִמִּצְוֹתֶיךָ:יא בְּלִבִּי צָפַנְתִּי אִמְרָתֶךָ לְמַעַן לֹא אֶחֱטָא לָךְ:יב בָּרוּךְ אַתָּה יְהוָה לַמְּדֵנִי חֻקֶּיךָ:יג בִּשְׂפָתַי סִפַּרְתִּי כֹּל מִשְׁפְּטֵי פִיךָ:יד בְּדֶרֶךְ עֵדְוֹתֶיךָ שַׂשְׂתִּי כְּעַל כָּל הוֹן:טו בְּפִקֻּדֶיךָ אָשִׂיחָה וְאַבִּיטָה אֹרְחֹתֶיךָ:טז בְּחֻקֹּתֶיךָ אֶשְׁתַּעֲשָׁע לֹא אֶשְׁכַּח דְּבָרֶךָ: