0
我有一个变量(MyFile
),它根据某些参数存储文件名。它存储的值很好(因为msgbox
函数显示了4个名称中的每一个),但是当我将它放入Application.GetSaveAsFilename(MyFile)
函数中时,只有在对话框打开时显示其他文件名。GetSaveAsFilename只显示其他所有变量值
验证码:
Sub Button1_Click()
Dim Customers() As String
Dim STD, LTD, LIFE, FMLA As Boolean
Dim FilePath As String
Dim i, c, n As Integer
i = 15
c = 0
n = 0
Range("C15").End(xlDown).Activate
Dim r As String
r = ActiveCell.Row
For i = 15 To r
STD = False
LTD = False
LIFE = False
FMLA = False
If ActiveSheet.Rows(i).Hidden = False Then
Dim loc As String
loc = "C" & i
Range(loc).Activate
ReDim Customers(c)
Customers(c) = ActiveCell.Value
Dim MyFile As String
If Range("Z" & i).Value <> "" Then
STD = True
End If
If Range("AA" & i).Value <> "" Then
LTD = True
End If
If Range("AB" & i).Value <> "" Then
FMLA = True
End If
If Range("AC" & i).Value <> "" Then
LIFE = True
End If
MyFile = Customers(c)
If STD = True Then
MyFile = MyFile & " - STD"
End If
If LTD = True Then
MyFile = MyFile & " - LTD"
End If
If LIFE = True Then
MyFile = MyFile & " - Life"
End If
If FMLA = True Then
MyFile = MyFile & " - FMLA"
End If
MsgBox (MyFile)
FilePath = Application.GetSaveAsFilename(MyFile)
c = c + 1
End If
Next
End Sub
你能不能请发布代码?这对诊断问题很有帮助。另请参阅:https://codeblog.jonskeet.uk/2012/11/24/stack-overflow-question-checklist/ – Graham
只需添加代码 –