我可以将Excel工作表范围导出为.xml。但是,我想保存而不使用.xml扩展名。
我之前设法做到了,但又失去了它。
Sub CREATEXML()
Dim Password As String
Do Until Password = "away"
Password = InputBox("ARE YOU SURE???" & vbNewLine & "" & vbNewLine & "Please enter password below", "Processing...", "????")
If Password = "" Then
Exit Sub
End If
Loop
ActiveWorkbook.Sheets("XML").Activate
Dim FileName As Variant
Dim Sep As String
FileName = Application.GetSaveAsFilename(InitialFileName:=AUTHORISESEPA.ValDtAUTHFILE.Value & "TESTING.xml", FileFilter:="XML Data(*.xml),*")
If FileName = False Then
Exit Sub
End If
Sep = ""
If Sep = vbNullString Then
End If
Debug.Print "FileName: " & FileName, "Separator: " & Sep
ExportToTextFile FName:=CStr(FileName), Sep:=CStr(Sep), _
SelectionOnly:=True, AppendData:=True
End Sub
我最终应该使用1111112.21012014TESTING
,而不是1111112.21012014TESTING.xml
这就是问题所在:
FileName = Application.GetSaveAsFilename( _
InitialFileName:=AUTHORISESEPA.ValDtAUTHFILE.Value & "TESTING.xml", _
FileFilter:="XML Data(*.xml),*")
答案 0 :(得分:1)
在你提到的那一行中,你要添加“TESTING.xml”。
FileName = Application.GetSaveAsFilename( _
InitialFileName:=AUTHORISESEPA.ValDtAUTHFILE.Value & "TESTING.xml", _
FileFilter:="XML Data(*.xml),*")
只需删除“.xml”:
FileName = Application.GetSaveAsFilename( _
InitialFileName:=AUTHORISESEPA.ValDtAUTHFILE.Value & "TESTING", _
FileFilter:="All files,*")