View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default importing XML files

The only time I get your error is if a put in a bad path or the path includes
a filename. It fails on the line

Set folder = _
fso.GetFolder(myfolder)

Make sure you are only putting in the path name without any file name.

" wrote:

On Jun 28, 12:30 pm, Joel wrote:
Sub getxml()

Const myfolder As String = "c:\temp"

Set fso = CreateObject _
("Scripting.FileSystemObject")
Set folder = _
fso.GetFolder(myfolder)

If folder.subfolders.Count 0 Then
For Each sf In folder.subfolders

If sf.Files.Count 0 Then
For Each file In sf.Files
If UCase(Right(file, 3)) = "XML" Then

'add code to open each file here.

End If

Next file
End If

Next sf
End If

End Sub



" wrote:
Hi!


Firstly, is there a macro to go through many subfolders and change the
extension of all the files? Or if I do that myself,
Is there a way to somehow get a macro to seek the XML files, if
they're all in groups separated by folders?
So, have the macro get the 1st file (using an XML map), edit it using
another macro, save and close, then go get the next folder?


I have a series of groups of XML files, all following the same XML Map
in Excel, and I want a macro to bring them in, group by group, saving
them as separate files.


Thanks!- Hide quoted text -


- Show quoted text -


Thank you so much! When I try to implement that though, it says that
the 'path is not found' although I put the path where the files are
where it was written c:/temp. The path I put is where all the
subfolders are. What am I doing wrong?