Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11
Default 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
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
Parse cell value based on contents Craig860 Excel Discussion (Misc queries) 7 September 24th 08 01:31 PM
Formatting one cell based on the contents of another [email protected] Excel Discussion (Misc queries) 4 April 13th 07 06:15 PM
How do I add a cell based on another cells contents? Debbie Excel Discussion (Misc queries) 1 December 22nd 06 06:33 PM
Can I format a row based on the contents of one cell? Kirsty Excel Discussion (Misc queries) 1 May 23rd 06 02:57 PM
Sum numbers based on the contents of another cell Doreen Excel Worksheet Functions 5 May 5th 05 04:41 PM


All times are GMT +1. The time now is 12:19 PM.

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"