简体   繁体   English

在VBA中修复中间函数的语法错误?

[英]Fixing a syntax error of a mid function in VBA?

I'm working in VBA excel and I'm trying to write a mid function but I keep getting a syntax error and I can't figure it out. 我正在VBA excel中工作,并且试图编写一个中间函数,但是我不断收到语法错误,无法弄清。

Here's the code: 这是代码:

Mid=("RXOTRX", "8", "7");

If you're trying to use the VBA Mid function, then your code should look something like this: 如果您尝试使用VBA Mid函数,那么您的代码应如下所示:

MidValue = Mid("RXOTRX", 8, 7)

Note that in your example, the start position would be past the end of your search string "RXOTRX" so it would return a zero-length string ( "" ). 请注意,在您的示例中,开始位置将超过搜索字符串"RXOTRX"的末尾,因此它将返回长度为零的字符串( "" )。

Additional documentation about the Mid function can be found here: http://msdn.microsoft.com/en-us/library/05e63829(v=vs.90).aspx 有关Mid函数的其他文档可以在这里找到: http : //msdn.microsoft.com/zh-cn/library/05e63829(v=vs.90).aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM