I have a little issue with unwanted characters at the end of number. I mean "numerek". There is no blank space, because function Replace work and it is no help. I tried use function Trim, but still no help for me. For example "numerek" = "1121123123" and it is 13 characters for VBA, but there is no space and exactly we can see that there is 10 characters! When I use MsgBox (numerek) it gives "1121123123 " . How can I delete this " " characters, when I know that it is no blank space? This program has to give me all number without "blank space" but it is not blank space. I'm using it in Outlook VBA. Please help :)
Dim MyOlNamespace As NameSpace
Dim MySelectedItem As MailItem
Dim Response As String
Dim fso As Object, TmpFolder As Object
Dim tmpFileName As String
Dim wrdApp As Object
Dim wrdDoc As Object
Dim bStarted As Boolean
Dim dlgSaveAs As FileDialog
Dim fdfs As FileDialogFilters
Dim fdf As FileDialogFilter
Dim i As Integer
Dim WshShell As Object
Dim SpecialPath As String
Dim msgFileName As String
Dim strCurrentFile As String
Dim strName As String
Dim oRegEx As Object
Dim intPos As Long
Dim itm As Outlook.MailItem
Dim currentExplorer As Explorer
Dim Selection As Selection
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
Dim oldName
Dim file As String
Dim DateFormat As String
Dim newName As String
Dim numerek As String
Dim tytul_maila
Dim enviro As String
'Set currentExplorer = Application.ActiveExplorer
'Set Selection = currentExplorer.Selection
Set MyOlNamespace = Application.GetNamespace("MAPI")
Set MySelectedItem = ActiveExplorer.Selection.Item(1)
Set fso = CreateObject("Scripting.FileSystemObject")
serwer = "C:\Users\GZ76576\Documents\"
If InStr(MySelectedItem.Body, "faktury/rachunku") > 0 Then
wiersz = InStr(MySelectedItem.Body, "faktury/rachunku")
wiersz_koniec = InStr(MySelectedItem.Body, "Data wpływu")
If wiersz_koniec > wiersz Then
numerek = Mid(MySelectedItem.Body, wiersz + 20, wiersz_koniec - wiersz - 24)
numerek = Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(numerek, ":", ""), "/", ""), "-", ""), "*", ""), "\", ""), " ", ""), " ", ""), " ", ""), "|", ""), " ", ""), "_", "")
End If
End If
nrfaktury = InputBox("Wpisz numer" & vbNewLine & vbNewLine & "Zachowaj format" & vbNewLine & vbNewLine & "PRZYKLAD", , numerek)
If nrfaktury = "" Then
Exit Sub
End If
...