从Excel读取单元格数据 [英] Reading Cell data from Excel

查看:102
本文介绍了从Excel读取单元格数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!


只是一个简单的问题...


我需要从Excel电子表格中导入用户数据。在VB6中,我使用了


strData = xlWksht.Range(" $ A $ 1)& "


导入包含字符串数据的单元格。这很好用。


当我在.NET中做同样的事情时,我得到一个错误,因为右手

表达的一面不是串。 .NET版本的任何想法

那段代码?


TIA,

DaveS

Hi!

Just a quick question...

I need to import user data from an Excel spreadsheet. In VB6, I used

strData = xlWksht.Range("$A$1) & ""

to import a cell with string data in it. That worked just fine.

When I do the same thing in .NET, I get an error since the right hand
side of the expression is not a string. Any ideas of the .NET version
of that line of code?

TIA,
DaveS

推荐答案

A


1)& "


导入包含字符串数据的单元格。这很好用。


当我在.NET中做同样的事情时,我得到一个错误,因为右手

表达的一面不是串。 .NET版本的任何想法

的那行代码?


TIA,

DaveS
1) & ""

to import a cell with string data in it. That worked just fine.

When I do the same thing in .NET, I get an error since the right hand
side of the expression is not a string. Any ideas of the .NET version
of that line of code?

TIA,
DaveS


嗨Dave,


尝试

strData = CStr(xlWksht.Range("
Hi Dave,

Try
strData = CStr (xlWksht.Range ("


这篇关于从Excel读取单元格数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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