Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
GrahamN
 
Posts: n/a
Default Create individual files from a row


I have an excel file with several thousand entries, which contain data
in several columns. I would like to be able to create an individual
xml or html file for each row, but with predifined formatting around
so

Mr A bloggs, A street, A town, AA1 1AA

Could become Abloggs.html

<head</head
<nameMr A bloggs</name
<streetA street</street
Any other info here as well
</html

etc. Is this possible and any suggestions how?

thanks,
Graham.


--
GrahamN
------------------------------------------------------------------------
GrahamN's Profile: http://www.excelforum.com/member.php...o&userid=24891
View this thread: http://www.excelforum.com/showthread...hreadid=384300

  #2   Report Post  
Fred
 
Posts: n/a
Default

Graham,

How good is your HTML coding?

You could write a macro to do exactly what you want.

HTH

"GrahamN" wrote:


I have an excel file with several thousand entries, which contain data
in several columns. I would like to be able to create an individual
xml or html file for each row, but with predifined formatting around
so

Mr A bloggs, A street, A town, AA1 1AA

Could become Abloggs.html

<head</head
<nameMr A bloggs</name
<streetA street</street
Any other info here as well
</html

etc. Is this possible and any suggestions how?

thanks,
Graham.


--
GrahamN
------------------------------------------------------------------------
GrahamN's Profile: http://www.excelforum.com/member.php...o&userid=24891
View this thread: http://www.excelforum.com/showthread...hreadid=384300


  #3   Report Post  
GrahamN
 
Posts: n/a
Default


I guessed a Macro may be the way, but this is an area I'm not too clued
up on Anyone know any good resources?


--
GrahamN
------------------------------------------------------------------------
GrahamN's Profile: http://www.excelforum.com/member.php...o&userid=24891
View this thread: http://www.excelforum.com/showthread...hreadid=384300

  #4   Report Post  
Dave Peterson
 
Posts: n/a
Default

I have no idea where the data is kept (different columns I hope???).

But this may give you some ideas:

Option Explicit
Sub testme()

Dim myFileName As String
Dim FileNum As Long

Dim myFolder As String

Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long

'make sure it exists!
myFolder = "C:\temp"
If Right(myFolder, 1) < "\" Then
myFolder = myFolder & "\"
End If

With Worksheets("sheet1")
FileNum = FreeFile
FirstRow = 2 'headers in row 1??
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row

For iRow = FirstRow To LastRow

Close FileNum
myFileName = myFolder & "out" _
& Format(iRow - FirstRow + 1, "0000") & ".txt"

Open myFileName For Output As FileNum

Print #FileNum, "<head</head"
Print #FileNum, "<name" & .Cells(iRow, "A").Text & "</name"
Print #FileNum, "<street" & .Cells(iRow, "b").Text & "</street"
Print #FileNum, "Any other info here as well"
Print #FileNum, "</html"

Close FileNum

Next iRow

End With

End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

GrahamN wrote:

I have an excel file with several thousand entries, which contain data
in several columns. I would like to be able to create an individual
xml or html file for each row, but with predifined formatting around
so

Mr A bloggs, A street, A town, AA1 1AA

Could become Abloggs.html

<head</head
<nameMr A bloggs</name
<streetA street</street
Any other info here as well
</html

etc. Is this possible and any suggestions how?

thanks,
Graham.

--
GrahamN
------------------------------------------------------------------------
GrahamN's Profile: http://www.excelforum.com/member.php...o&userid=24891
View this thread: http://www.excelforum.com/showthread...hreadid=384300


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
create a inventory of files on computer in excel Shanerrs Excel Discussion (Misc queries) 1 April 27th 05 04:07 PM
create a list of worksheet names (from a single folder, or open files) Drew Excel Discussion (Misc queries) 2 April 15th 05 04:58 PM
how do i create an access code sheet to number my office files an. dana New Users to Excel 1 February 12th 05 03:49 AM
Why does Excel in XP create new files? Lindy Excel Discussion (Misc queries) 3 December 2nd 04 12:56 AM
how do you create drop down menus for individual cells in excel? Frosty1 Excel Worksheet Functions 2 November 15th 04 11:02 PM


All times are GMT +1. The time now is 07:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"