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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HARD RETURN

Status
Not open for further replies.

patweb

Programmer
Apr 17, 2003
174
0
0
BE
I have a little piece of code that writes a file name and afterwards zips this automatically. Not visible but during this he include a hard return in the name of the file.

When uploading this to a webserver a apache server seems this and when a user likes to download the file, he can't find it, because there is a hard return in it.

Why is a hard return included and how can we avoid this or delete this. I have tried trim() but this is only for spaces. Perhaps a replace function ?
 
Could you post your code showing how you generate the filename with the 'hard return' in?

Harleyquinn
---------------------------------
Help us to help you,
read FAQ222-2244 before posting.
 
Code:
Public Sub S95ZIP()
Dim SourceFile, destinationfile, DestinationZIP, sourcefile1, strpad, i, filetosave, zipfilename

strpad = includedir()

With Application.FileSearch
    .FileName = ".xls*"
    .LookIn = strpad
    If .Execute() > 0 Then
& .FoundFiles.Count & " bestand(en) gevonden."
    For i = 1 To .FoundFiles.Count
    SourceFile = Dir(strpad & "*.xls*") ' Define source filename.
    SourceFile = Trim(SourceFile)
    filetosave = strpad & SourceFile
    Rem 2003-04-24 : test = msgbox filetosave
    zipfilename = Len(SourceFile)
    zipfilename = zipfilename - 4
    zipfilename = Left(SourceFile, zipfilename)
    zipfilename = strpad & zipfilename & ".zip"
    zipfilename = replace(zipfilename, "\r", "")
    Next
    Else
    End If
End With

Call Shell("c:\Program Files\winzip\Winzip32.exe -A " _
& """" & zipfilename & """" & " " & """" & filetosave & """", vbHide)
The hard return is not visible.

I have tried this : using access 97, is the function replace not available and if not, how to define or to replace by another ? zipfilename = replace(zipfilename, "\r", "")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top