كود VBA لتغيير امتداد الملف

كود VBA لتغيير امتداد الملف
جدول المحتويات

Change File Extension using VBA Code (with Images)

ماذا فعلا:

This VBA code will help you change file extension of the files in a particular folder/directory.

For eg. If you want to change the extension of the Excel files received in .xlsx to .xls or visaversa then this VBA code can be used.

لماذا:

If you are working on project where you get input files with different file extensions where in you want the files in a standard format for your VBA program to work and you don’t have any control over the input files then this peace of code will be very helpful as you can change extension to any format you want.

Windows Script object is used to change the extension in this code.

How to Change File Extension using VBA code:





Step 1: Open the workbook that need to be protected and press Alt + F11

الخطوة 2: انسخ الكود التالي والصقه في نافذة محرر VBA واحفظ المصنف.

				
					Sub changeExt()

strDir = "C:\myFolder\" 'mention your files folder path here

With CreateObject("wscript.shell")

   .currentdirectory = strDir

   .Run "%comspec% /c ren *.xlsx *.xls", 0, True

End With

End Sub
				
			

 

Step 3: Click F5 to run the code.

Change File Extension


Picture of Anson Antony
أنسون أنتوني
أنسون هو مؤلف مساهم ومؤسس في www.askeygeek.com. لقد كان تعلم أي شيء جديد هو شغفه دائمًا، ASKEYGEEK.com هو نتيجة شغفه بالتكنولوجيا والأعمال. لقد حصل على عقد من الخبرة المتنوعة في الاستعانة بمصادر خارجية للعمليات التجارية، والمالية والمحاسبة، وتكنولوجيا المعلومات، والتميز التشغيلي وذكاء الأعمال. خلال فترة عمله، عمل في مؤسسات مثل Genpact وHewlett Packard وM*Modal وCapgemini في أدوار ومسؤوليات مختلفة. بعيدًا عن الأعمال والتكنولوجيا، فهو من عشاق الأفلام ويقضي ساعات معًا في مشاهدة وتعلم السينما وصانع أفلام أيضًا!

3 Responses

اترك رداً على dossfm إلغاء الرد

لن يتم نشر عنوان بريدك الإلكتروني. الحقول الإلزامية مشار إليها بـ *

تهانينا!
لقد فعلتها،
لا تغلق!

الحصول على ما يصل الى 60.000 أرصدة شخصيات UberTTS مجانًا!!!

هذه النافذة المنبثقة لن تظهر متروك لكم مرة أخرى!!!

أوبر تي تي إس
Share to...