作者:用户7krcbz6eb6 | 来源:互联网 | 2023-06-02 16:58
IhaveExcelspreadsheetthatgetsitssettingsfromanOracledatabase.Imtryingtoupdateeachw
I have Excel spreadsheet that gets its settings from an Oracle database. I'm trying to update each worksheet's row height by calling the worksheet using a recordset value (the name of the worksheet). rsSettings(1) is a string value that's the worksheet name. rsSettings(2) is a row number and rsSettings(3) is a row height. This is giving me a Type Mismatch error:
我有Excel电子表格,可以从Oracle数据库中获取设置。我试图通过使用记录集值(工作表的名称)调用工作表来更新每个工作表的行高度。rsSettings(1)是一个字符串值,它是工作表名称。rsSettings(2)是行号,rsSettings(3)是行高度。这给了我一个类型错配错误:
Do Until rsSettings.EOF
WB.Worksheets(rsSettings(1)).Cells(rsSettings(2), 1).RowHeight = rsSettings(3)
rsSettings.MoveNext
Loop
This does work if I replace rsSettings(1) with a literal string value or a string variable that gets its value from rsSettings(1) or (as I just found out) if I do CStr(rsSettings(1)). (And also, I can write the value to a cell.)
如果我将rsSettings(1)替换为文字字符串值或从rsSettings(1)获取值的字符串变量,或者(正如我刚才发现的)替换为CStr(rsSettings(1),那么这样做是可行的。(我还可以将值写到单元格中。)
So while the problem is solved for now using CStr(), should it be possible to use a recordset value as a string value where an index value would go?
因此,虽然现在使用CStr()解决了这个问题,但是是否可以将记录集值作为字符串值来使用,索引值就会在这个字符串值中出现?
1 个解决方案