ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   change type of a file (https://www.excelbanter.com/excel-programming/349586-change-type-file.html)

דיצה

change type of a file
 
I need code which take file from type file and change the type to be excel file

Chip Pearson

change type of a file
 
I'm not at all sure what you mean, but you can change the name of
a file with code like


Name "H:\test2" As "H:\test2.xls"



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"????" wrote in message
...
I need code which take file from type file and change the type
to be excel file




דיצה

change type of a file
 
It's answer the quaton that I asked, but I need same thing a little bet maor
compicated.
I can use the file name becuse there is a loop that opens all the files in
the same folder.
Here is the code the line that shifting right is problematic(it got an erro
mesage object doesn't supporat this property or methode ). I will be happy if
same one would be able to deal with it
thanks

Dim oFSO

Sub LoopFolders()
Dim i As Integer

Set oFSO = CreateObject("Scripting.FileSystemObject")

selectFiles "c:\MyTest"

Set oFSO = Nothing

End Sub


'---------------------------------------------------------------------------
Sub selectFiles(sPath)
'---------------------------------------------------------------------------
Dim Folder As Object
Dim Files As Object
Dim file As Object
Dim fldr

Set Folder = oFSO.GetFolder(sPath)

For Each fldr In Folder.Subfolders
selectFiles fldr.Path
Next fldr

For Each file In Folder.Files
Workbooks.Open Filename:=file.Path

Name ActiveWorkbook As
file.Path.xls


ActiveWorkbook.Save
ActiveWorkbook.Close
Next file

End Sub


"Chip Pearson" wrote:

I'm not at all sure what you mean, but you can change the name of
a file with code like


Name "H:\test2" As "H:\test2.xls"



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"????" wrote in message
...
I need code which take file from type file and change the type
to be excel file






All times are GMT +1. The time now is 12:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com