Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel 删除不需要的字符_Excel_Vba_Outlook_Character - Fatal编程技术网

Excel 删除不需要的字符

Excel 删除不需要的字符,excel,vba,outlook,character,Excel,Vba,Outlook,Character,我对数字末尾不需要的字符有点问题。我是说“numerek”。这里没有空白,因为函数替换了工作,没有帮助。我尝试使用功能修剪,但仍然没有帮助我。例如“numerek”=“1121123123”,VBA是13个字符,但没有空格,我们可以看到有10个字符!当我使用MsgBox(numerek)时,它给出“1123123”。当我知道这不是空白时,如何删除“”字符?这个程序必须给我所有没有“空格”的数字,但它不是空格。我正在Outlook VBA中使用它。请帮忙:) 根据明确的要求进行更新,不真正需要“数

我对数字末尾不需要的字符有点问题。我是说“numerek”。这里没有空白,因为函数替换了工作,没有帮助。我尝试使用功能修剪,但仍然没有帮助我。例如“numerek”=“1121123123”,VBA是13个字符,但没有空格,我们可以看到有10个字符!当我使用MsgBox(numerek)时,它给出“1123123”。当我知道这不是空白时,如何删除“”字符?这个程序必须给我所有没有“空格”的数字,但它不是空格。我正在Outlook VBA中使用它。请帮忙:)


根据明确的要求进行更新,不真正需要“数字”

下面的函数允许您准确列出要包含在
numerek
中的字符。我给你写了几封信让你开始。您也可以尝试利用字符号,但可能需要更多的时间进行研究,而不仅仅是键入字符。不要忘记大写/小写

样本结果:
=固定件(“12 3b”)
=
“123b”


你可以看一看。好的,非常感谢你,它只对数字有效,但是如果:numeek=“RDY1012JG101”它不能读取我的“RDY”和“JG”,它只能读取“1012101”,我该怎么办?@Grzegorz也许可以试试这个解决方案?@PGCodeRider谢谢你的回答,它有效,我点击了绿色复选框,再次感谢;)
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
...
Function fixerThing(inputValue As String) As String
Dim i As Long, theCharacter As String

For i = 1 To Len(inputValue)

    theCharacter = Mid(inputValue, i, 1)

    Select Case theCharacter
        Case "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "a", "b", "c", "d", _
         "e", "f" 'you can type out the rest.
            fixerThing = fixerThing & theCharacter

    End Select

Next i

End Function