파일 이름을 함께 입력 할 필드를 선택하는 Word 2013 템플릿 용 VB 스크립트가 있습니다.Visual Basic에서 파일 이름에 쓸모없는 문자를 대체하십시오.
원하지 않는 문자, 기호 및 특수 문자를 파일 이름으로 대체하려면 어떻게해야합니까?
Imports System.Text.RegularExpressions ' wrong?
Sub FileSave()
If ActiveDocument.Path = "" Then
FileSaveAs
Exit Sub
End If
ActiveDocument.Save
End Sub
Sub FileSaveAs()
Dim DocName As String
If (ActiveDocument.Bookmarks.Exists("Datum") = True) And (ActiveDocument.Bookmarks.Exists("Betreff") = True) And (ActiveDocument.Bookmarks.Exists("Bezug") = True) Then
a = Trim(ActiveDocument.Bookmarks("Datum").Range.Text)
b = Trim(ActiveDocument.Bookmarks("Betreff").Range.Text)
c = Trim(ActiveDocument.Bookmarks("Bezug").Range.Text)
DocName = a & " - " & b & " - " & c
DocName = Replace(DocName, "/^*\s*/$", "") ' wrong
Else
DocName = ActiveDocument.Name
End If
With Dialogs(wdDialogFileSaveAs)
.Name = DocName
.Show
End With
최종 하위
이 기능 반환 무엇? – cy221
예 ... 분명히 일부 부품을 놓쳤습니다. 편집 해 주셔서 감사합니다. – Matt