#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default in msg

Hi,
How is the best way to show in msgbox contain some file
e.g. text file?
Regards
Mark
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default 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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default 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

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default 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

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default 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

.

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



All times are GMT +1. The time now is 02:55 PM.

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

About Us

"It's about Microsoft Excel"