导出到excel选项期望的表达式? [英] expression expected in export to excel option ?

查看:91
本文介绍了导出到excel选项期望的表达式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道在列表项类的括号之后放什么,所以它们是错误的说



表达式预期



这是代码:



I dont know what to put after the bracket of the list item class, so their is an error saying

expression expected

This is the code:

xlRange = sheet.Range("A3", "I3")
xlRange.Font.Bold = True
xlRange.ColumnWidth = 13
xlRange.Value = {"Asset Id", "Barcode", "Asset Name", "Employee Name", "Location", "Sl.No", "Computer Name", "Model No", "allocation date"}







错误显示在开放括号附近的xlrange.value行。




error displays in xlrange.value line near to the opening bracket.

推荐答案

大括号在VBA中不起作用。请改为尝试:

Curly braces don't work in VBA. Try this instead:
xlRange.Value = Array("Asset Id", "Barcode", "Asset Name", "Employee Name", "Location", "Sl.No", "Computer Name", "Model No", "allocation date")





祝你好运!



Good luck!


如果要将值添加到单元格 A3 I3 ,请尝试:

If you want to add values into cell A3 to I3, try this:
Dim headers As String = "Asset Id,Barcode,Asset Name,Employee Name,Location,Sl.No,Computer Name,Model No,allocation date"

'further
xlRange = sheet.Range("A3:I3")
xlRange.Font.Bold = True
xlRange.ColumnWidth = 13
xlRange = headers.Split(",")


这篇关于导出到excel选项期望的表达式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆