Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Long path in msgbox

Status
Not open for further replies.

wmbb

Technical User
Jul 17, 2005
320
NL
I want to show the full filename of the active document in a messagebox.
Since the path can be very long a linefeed is added automatically in the message box.
Is it possible to keep the full path at one line if there are spaces in the pathname ?

the messagebox is now showing:

The file will be saved as:
D:\backupdata\archive\MS Excel\dept10080\Chemical
Analyses\2012\test v1.xls


and I want the messagebox to show:

The file will be saved as:
D:\backupdata\archive\MS Excel\dept10080\Chemical Analyses\2012\test v1.xls


Is there an option to prevent the linebreak ?
 
Try:
Code:
Sub Demo()
Dim StrPath As String
StrPath = "D:\backupdata\archive\MS Excel\dept10080\Chemical Analyses\2012\test v1.xls"
StrPath = Replace(StrPath, " ", Chr(160))
MsgBox StrPath
End Sub

Cheers
Paul Edstein
[MS MVP - Word]
 
In your QAT, you can customize to SHOW the full filename & path. It is called Document Location. Why mess with a msgbox?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
It seems that the maximal width of message box is around 60% of screen width, change of resolution results in different line breaking.
You may consider to use a custom userform that mimics messagebox instead.

combo
 
>the maximal width of message box is around 60% of screen width

Depends on your platform. The algorithm the msgbox uses has changed several times ..., but I'd concur with the advice to use a custom userform
 
Thanks you all for your input.
I'll solve the problem with a custom userform.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top