مع VBA، كيف يمكنني التحقق من ذلك ما إذا كان، في مستكشف Windows، يتم إخفاء ملحقات الملفات لأنواع الملفات المعروفة؟
-
19-09-2019 - |
سؤال
دون فتح مستكشف Windows. أريد التحقق من ذلك من Word VBA.
شكرا.
تعديل:
يعمل هذا الرمز الآن:
Set WshShell = CreateObject("WScript.Shell")
If WshShell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt") = 0 Then
MsgBox Prompt:="In Windows Explorer, set the folder options to hide file extensions of known file types." _
& vbCrLf & vbCrLf & " This prevents the file extension from appearing as part of the document number in" _
& "the document body and page headers.", Buttons:=vbOKOnly + vbCritical, Title:="Critical"
End If
المحلول
تحتاج إلى الاستعلام عن قيمة التسجيل
HKEY_CURRENT_USER Software Microsoft Windows CurrentVersion Explorer Advanced HideFileext
يتم عرض ملحقات إذا كانت هذه القيمة هي 0 ومخفية إذا كان 1.
يمكنك استعمال ال ريجراد الطريقة على كائن Wshshell لقراءة هذه القيمة. يمكنك إضافة مرجع إلى مكتبة نوع مجموعة أدوات Windows Script Host في مشروع VBA الخاص بك للحصول على كتابة قوية عند استخدام كائن Wshshell.
لا تنتمي إلى StackOverflow