vbmid函数的使用方法

 我来答
吹花PM
2013-12-16 · TA获得超过946个赞
知道小有建树答主
回答量:635
采纳率:0%
帮助的人:600万
展开全部
从贴出来的图片看,与Mid()函数无关。
Mid("abcde",2,2) ——"bc" Mid("abcde",2) ——"bcde"
MSDN,最好的示例:

Dim MyString, FirstWord, LastWord, MidWords
MyString = "Mid Function Demo" ' Create text string.
FirstWord = Mid(MyString, 1, 3) ' Returns "Mid".
LastWord = Mid(MyString, 14, 4) ' Returns "Demo".
MidWords = Mid(MyString, 5) ' Returns "芹启亮Function Demo".
The second example use MidB and a user-defined function (MidMbcs) to also return characters from string. The difference here is that the input string is ANSI and the length is in bytes.
Function MidMbcs(ByVal str as String, start, length)
MidMbcs = StrConv(MidB(StrConv(str, vbFromUnicode), start, length), vbUnicode)
End Function
Dim MyString
MyString = "AbCdEfG"
' Where "A", "C"旁枝, "嫌宽E", and "G" are DBCS and "b", "d",
' and "f" are SBCS.
MyNewString = Mid(MyString, 3, 4)
' Returns ""CdEf"
MyNewString = MidB(MyString, 3, 4)
' Returns ""bC"
MyNewString = MidMbcs(MyString, 3, 4)
' Returns "bCd"
追问
额 弄错了 我想问的是贴图的问题  就是那个时间16两边怎么又空格 还有星期2的2怎么写成二
追答
最好是写成一个字符串的形式,如下:
Private Sub Command1_Click()
Print "现在的时间是:" & Year(Now) & "年" & Month(Now) & "月" & Day(Now) & "日" & _
"星期" & Choose(Weekday(Now), "日", "一", "二", "三", "四", "五", "六") & _
Hour(Now) & "时" & Minute(Now) & "分" & Second(Now) & "秒"
End Sub
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式