Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Creating .txt files based on cell contents
I currently have a list of names and want to create a notes file for each
that I can hyperlink to. The hyper linking is fine. However I have over 300 files I need to create. Any suggestions would be gratefully accepted Many Thanks |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Creating .txt files based on cell contents
Mat,
Right click your sheet tab, view code and paste the code below in. Change MyPath to the directory you want the text files in. It will read down column A and for every name it will create a text file using that name(If it doesn't already exist) and create a hyperlink to it. Sub Lime() lastrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row MyPath = "C:\" Set MyRange = Range("A1:A" & lastrow) For Each c In MyRange Fname = MyPath & c.Value & ".txt" If Dir(Fname, vbNormal) = "" Then Open Fname For Output As #1 Close #1 ActiveSheet.Hyperlinks.Add Anchor:=c, Address:=MyPath & c.Value & ".txt" End If Next End Sub Mike "Matt Bennette" wrote: I currently have a list of names and want to create a notes file for each that I can hyperlink to. The hyper linking is fine. However I have over 300 files I need to create. Any suggestions would be gratefully accepted Many Thanks |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Creating .txt files based on cell contents
Thanks dude that worked a treat. !!! Genius
"Mike H" wrote: Mat, Right click your sheet tab, view code and paste the code below in. Change MyPath to the directory you want the text files in. It will read down column A and for every name it will create a text file using that name(If it doesn't already exist) and create a hyperlink to it. Sub Lime() lastrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row MyPath = "C:\" Set MyRange = Range("A1:A" & lastrow) For Each c In MyRange Fname = MyPath & c.Value & ".txt" If Dir(Fname, vbNormal) = "" Then Open Fname For Output As #1 Close #1 ActiveSheet.Hyperlinks.Add Anchor:=c, Address:=MyPath & c.Value & ".txt" End If Next End Sub Mike "Matt Bennette" wrote: I currently have a list of names and want to create a notes file for each that I can hyperlink to. The hyper linking is fine. However I have over 300 files I need to create. Any suggestions would be gratefully accepted Many Thanks |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Creating .txt files based on cell contents
Glad I could help
"Matt Bennette" wrote: Thanks dude that worked a treat. !!! Genius "Mike H" wrote: Mat, Right click your sheet tab, view code and paste the code below in. Change MyPath to the directory you want the text files in. It will read down column A and for every name it will create a text file using that name(If it doesn't already exist) and create a hyperlink to it. Sub Lime() lastrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row MyPath = "C:\" Set MyRange = Range("A1:A" & lastrow) For Each c In MyRange Fname = MyPath & c.Value & ".txt" If Dir(Fname, vbNormal) = "" Then Open Fname For Output As #1 Close #1 ActiveSheet.Hyperlinks.Add Anchor:=c, Address:=MyPath & c.Value & ".txt" End If Next End Sub Mike "Matt Bennette" wrote: I currently have a list of names and want to create a notes file for each that I can hyperlink to. The hyper linking is fine. However I have over 300 files I need to create. Any suggestions would be gratefully accepted Many Thanks |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
Creating .txt files based on cell contents
If I might impose on your genius once more.
I have been trying to extract email addresses from word documents, about 1000. Ideally the result would produce a list of filenames in column A and the email address extracted from that file in column B. Usually, there would only be 1 email address per file. Again Many thanks "Mike H" wrote: Glad I could help "Matt Bennette" wrote: Thanks dude that worked a treat. !!! Genius "Mike H" wrote: Mat, Right click your sheet tab, view code and paste the code below in. Change MyPath to the directory you want the text files in. It will read down column A and for every name it will create a text file using that name(If it doesn't already exist) and create a hyperlink to it. Sub Lime() lastrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row MyPath = "C:\" Set MyRange = Range("A1:A" & lastrow) For Each c In MyRange Fname = MyPath & c.Value & ".txt" If Dir(Fname, vbNormal) = "" Then Open Fname For Output As #1 Close #1 ActiveSheet.Hyperlinks.Add Anchor:=c, Address:=MyPath & c.Value & ".txt" End If Next End Sub Mike "Matt Bennette" wrote: I currently have a list of names and want to create a notes file for each that I can hyperlink to. The hyper linking is fine. However I have over 300 files I need to create. Any suggestions would be gratefully accepted Many Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Parse cell value based on contents | Excel Discussion (Misc queries) | |||
Formatting one cell based on the contents of another | Excel Discussion (Misc queries) | |||
How do I add a cell based on another cells contents? | Excel Discussion (Misc queries) | |||
Can I format a row based on the contents of one cell? | Excel Discussion (Misc queries) | |||
Sum numbers based on the contents of another cell | Excel Worksheet Functions |