Excel vba 我做了个用户窗体,里面一个文本框,怎么每次打开窗体,都得把文本框重新输入一次?
文本框写着:PrivateSub佣金分析位置_MouseDown(ByValButtonAsInteger,ByValShiftAsInteger,ByValXAsSin...
文本框写着:
Private Sub 佣金分析位置_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
ifilename = Application.GetOpenFilename
If ifilename = "False" Then
MsgBox "没有选择文件!"
Else
佣金分析位置 = ifilename
End If
End Sub
我选好了文件,每次打开,都得重新选择一次,这可如何是好? 展开
Private Sub 佣金分析位置_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
ifilename = Application.GetOpenFilename
If ifilename = "False" Then
MsgBox "没有选择文件!"
Else
佣金分析位置 = ifilename
End If
End Sub
我选好了文件,每次打开,都得重新选择一次,这可如何是好? 展开
1个回答
展开全部
Private Sub UserForm_Initialize()
TextBox1.MultiLine = True
TextBox1.Text = "Private Sub 佣金分析位置_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)" & vbCrLf & _
"ifilename = Application.GetOpenFilename" & vbCrLf & "If ifilename = " & """" & "False" & """" & " Then" & vbCrLf & _
" MsgBox " & """" & "没有选择文件!" & """" & vbCrLf & "Else" & vbCrLf & " ?????? = ifilename" & vbCrLf & "End If" & vbCrLf & "End Sub"
End Sub
追问
哥,这代码写在窗体里,还是改在textbox里面?
这个vbcrlf换行符,是你加上的,还是系统自己生成的?
追答
放到窗体里
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询