Kod VBA do zmiany rozszerzenia pliku

Kod VBA do zmiany rozszerzenia pliku
Spis treści

Change File Extension using VBA Code (with Images)

Co czy to:

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.

Dlaczego:

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

Krok 2: Skopiuj i wklej poniższy kod w oknie edytora VBA i zapisz skoroszyt.

				
					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
Anson Antoni
Anson jest współautorem i założycielem w www.askeygeek.com. Uczenie się czegokolwiek nowego zawsze było jego pasją, ASKEYGEEK.com jest wynikiem jego pasji do technologii i biznesu. Posiada dziesięcioletnie wszechstronne doświadczenie w outsourcingu procesów biznesowych, finansach i księgowości, technologiach informatycznych, doskonałości operacyjnej i inteligencji biznesowej. W trakcie swojej kadencji pracował dla takich organizacji jak Genpact, Hewlett Packard, M*Modal i Capgemini, zajmując różne role i obowiązki. Poza biznesem i technologią jest miłośnikiem kina, który spędza razem godziny, oglądając i ucząc się kina, a także Twórcy Filmowego!

3 odpowiedzi

Skomentuj dossfm Anuluj pisanie odpowiedzi

Twój adres e-mail nie zostanie opublikowany. Wymagane pola są oznaczone *

Gratulacje!
Zrobiłeś to,
Nie zamykaj!

Wstań do 60 000 Kredyty postaci UberTTS za darmo!!!

To wyskakujące okienko nie pokaże zależy od Ciebie Ponownie!!!

UberTTS
Share to...