![]() |
in msg
Hi,
How is the best way to show in msgbox contain some file e.g. text file? Regards Mark |
in msg
If it's a small amount of text, just read it in and plop it into your msgbox.
Here's a link that may help: http://support.microsoft.com/support...eio/fileio.asp Alternatively, if there's lots of stuff, you may want to just invoke NotePad. Dim myFileName As String myFileName = "C:\my documents\excel\test.txt" If Dir(myFileName) = "" Then 'do nothing Else Shell "start notepad " & myFileName End If Mark wrote: Hi, How is the best way to show in msgbox contain some file e.g. text file? Regards Mark -- Dave Peterson |
in msg
That link doesn't work anymore.
-- Regards, Tom Ogilvy "Dave Peterson" wrote in message ... If it's a small amount of text, just read it in and plop it into your msgbox. Here's a link that may help: http://support.microsoft.com/support...eio/fileio.asp Alternatively, if there's lots of stuff, you may want to just invoke NotePad. Dim myFileName As String myFileName = "C:\my documents\excel\test.txt" If Dir(myFileName) = "" Then 'do nothing Else Shell "start notepad " & myFileName End If Mark wrote: Hi, How is the best way to show in msgbox contain some file e.g. text file? Regards Mark -- Dave Peterson |
in msg
Hmmm.
Do you know of a replacement link? (I couldn't find one.) Tom Ogilvy wrote: That link doesn't work anymore. -- Regards, Tom Ogilvy "Dave Peterson" wrote in message ... If it's a small amount of text, just read it in and plop it into your msgbox. Here's a link that may help: http://support.microsoft.com/support...eio/fileio.asp Alternatively, if there's lots of stuff, you may want to just invoke NotePad. Dim myFileName As String myFileName = "C:\my documents\excel\test.txt" If Dir(myFileName) = "" Then 'do nothing Else Shell "start notepad " & myFileName End If Mark wrote: Hi, How is the best way to show in msgbox contain some file e.g. text file? Regards Mark -- Dave Peterson -- Dave Peterson |
in msg
And here's a sample of reading a text file:
Option Explicit Sub testme01() Dim myNumber As Long Dim myLine As String Dim myFileName As String Dim FileNum As Long myFileName = "C:\my documents\excel\text.txt" FileNum = FreeFile If Dir(myFileName) = "" Then 'not found MsgBox "File is missing!" Exit Sub Else Close FileNum Open myFileName For Input As FileNum Do While Not EOF(FileNum) Line Input #FileNum, myLine myNumber = Val(myLine) Loop Close FileNum End If End Sub This actually reads the last line of a text file (to get a number). Dave Peterson wrote: If it's a small amount of text, just read it in and plop it into your msgbox. Here's a link that may help: http://support.microsoft.com/support...eio/fileio.asp Alternatively, if there's lots of stuff, you may want to just invoke NotePad. Dim myFileName As String myFileName = "C:\my documents\excel\test.txt" If Dir(myFileName) = "" Then 'do nothing Else Shell "start notepad " & myFileName End If Mark wrote: Hi, How is the best way to show in msgbox contain some file e.g. text file? Regards Mark -- Dave Peterson -- Dave Peterson |
in msg
If I did, I wouldn't hold back <g
There are some KB articles about working with text files, but nothing as comprehensive as that one. -- Regards, Tom Ogilvy "Dave Peterson" wrote in message ... Hmmm. Do you know of a replacement link? (I couldn't find one.) Tom Ogilvy wrote: That link doesn't work anymore. -- Regards, Tom Ogilvy "Dave Peterson" wrote in message ... If it's a small amount of text, just read it in and plop it into your msgbox. Here's a link that may help: http://support.microsoft.com/support...eio/fileio.asp Alternatively, if there's lots of stuff, you may want to just invoke NotePad. Dim myFileName As String myFileName = "C:\my documents\excel\test.txt" If Dir(myFileName) = "" Then 'do nothing Else Shell "start notepad " & myFileName End If Mark wrote: Hi, How is the best way to show in msgbox contain some file e.g. text file? Regards Mark -- Dave Peterson -- Dave Peterson |
in msg
Thanks for reply, i a bit modified code and all work fine.
BEST REGARDS!! mark -----Original Message----- And here's a sample of reading a text file: Option Explicit Sub testme01() Dim myNumber As Long Dim myLine As String Dim myFileName As String Dim FileNum As Long myFileName = "C:\my documents\excel\text.txt" FileNum = FreeFile If Dir(myFileName) = "" Then 'not found MsgBox "File is missing!" Exit Sub Else Close FileNum Open myFileName For Input As FileNum Do While Not EOF(FileNum) Line Input #FileNum, myLine myNumber = Val(myLine) Loop Close FileNum End If End Sub This actually reads the last line of a text file (to get a number). Dave Peterson wrote: If it's a small amount of text, just read it in and plop it into your msgbox. Here's a link that may help: http://support.microsoft.com/support...ntent/fileio/f ileio.asp Alternatively, if there's lots of stuff, you may want to just invoke NotePad. Dim myFileName As String myFileName = "C:\my documents\excel\test.txt" If Dir(myFileName) = "" Then 'do nothing Else Shell "start notepad " & myFileName End If Mark wrote: Hi, How is the best way to show in msgbox contain some file e.g. text file? Regards Mark -- Dave Peterson -- Dave Peterson . |
in msg
I thought it was a test (and I failed!). <vvbg
"Tom Ogilvy" wrote in message ... If I did, I wouldn't hold back <g There are some KB articles about working with text files, but nothing as comprehensive as that one. -- Regards, Tom Ogilvy |
All times are GMT +1. The time now is 01:14 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com