View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
דיצה דיצה is offline
external usenet poster
 
Posts: 3
Default 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