在VBA中'(单引号)有什么作用? [英] What does ' (single quote) do in VBA?
问题描述
我在线获得了一个代码,可以帮助我将多个excel工作簿表快速组合到一个工作簿中.
I got a code online to help me combine multiple excel workbook sheets into one workbook quickly.
如果代码中包含更新,然后是网站",这是否意味着我正在运行并且将excel文件发送到那里? 或者 "update exceljunction.com"行的意义是什么?他们是在接收信息还是其他东西
If the code includes 'update and then a website, does that mean whatever I am running and the excel files get sent there? or what is the point of the 'update exceljunction.com line? are they receiving information or something
`Sub GetSheets()
'Update exceljunction.com
Path = "\"
Filename = Dir(Path & "*.xls")
Do while Filename <> ""
Workbooks.Open Filename:=Path & Filename, ReadOnly:=True
For Each Sheet In ActiveWorkbook.Sheets
Sheet.Copy After:=ThisWorkbook.Sheets(1)
Next Sheet
Workbooks(Filename).Close
Filename = Dir ()
Loop
End Sub`
推荐答案
不要从网站和博客文章中复制粘贴代码.
Don't copy-pasta code from websites and blog posts.
您可以选择
不间断的空格字符,这些字符会弄乱整个内容……然后您还可以选择其他在VBA代码中非法的怪异字符,例如将单引号‘
括起来表示评论.
You can pick up
non-breaking space characters that will royally mess things up... and then you also pick up other weird characters that are illegal in VBA code, like a curly single-quote ‘
to denote a comment.
VB中的注释标记为'
,而不是‘
.这就是为什么删除注释已修复"的原因.
The comment marker in VB is '
, not ‘
. That's why removing the comment "fixed it".
注释不是可执行代码,它们只是维护者的代码内文档.应该删除过时,误导,多余或其他无用的注释.
Comments aren't executable code, they're just in-code documentation for the maintainer. Obsolete, misleading, redundant or otherwise useless comments should be removed.
这篇关于在VBA中'(单引号)有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!