设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

12下一页
返回列表 发新帖
查看: 4137|回复: 14
打印 上一主题 下一主题

[基础应用] 恳请老鬼版主看看Excel连接表数据转移问题!

[复制链接]

点击这里给我发消息

跳转到指定楼层
1#
发表于 2004-12-12 06:58:00 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
老鬼版主:您好!这是大熊版主帮忙过的帖子,在office2003版本上可以使用,在2000上不能使用。请您指点一下如何在2000上也可使用.谢谢!

[em06]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
15#
发表于 2004-12-16 17:02:00 | 只看该作者
No.I will often  make mistakes too. But My teacher tell me that making Mistakes is the necessary step to study a foreign language.[em04]
14#
发表于 2004-12-15 06:08:00 | 只看该作者
熊版见笑了.本想用英文和熊兄交流一下,没成想不仅错发了两次,语法还有多个错误.惭愧!
13#
发表于 2004-12-14 21:54:00 | 只看该作者
many tks. at least we know how to deal with it now.
12#
发表于 2004-12-14 19:05:00 | 只看该作者
cause I found there were some sheets in OLE CALLING,see the code below

...

Debug.Print xlsApp.Workbooks.Count

...

the last one was the OLE OBJECT,other sheets were PERSONAL.XLS , XLA , XLL etc

but they were all unvisible 。

so i thought if this was the reason .

"All Were Unvisible " = "There Were No ActiveSheet" = "There Were No Current Sheet"

so we must gave the absolute reference of the sheet .

but i was puzzled why it was no error in the second try.

thanks.
11#
发表于 2004-12-14 18:59:00 | 只看该作者
cause I found there were some sheets in OLE CALLING,see the code below

...

Debug.Print xlsApp.Workbooks.Count

...

the last one was the OLE OBJECT,others sheets were PERSONAL.XLS , XLA , XLL etc

but they were all unvisible 。

so i thought if this was the reason .

"All Were Unvisible " = "There Were No ActiveSheet" = "There Were No Current Sheet"

so we must gave the absolute reference of the sheet .

but i was puzzled why it was no error in the second try.

thanks.
10#
发表于 2004-12-14 06:12:00 | 只看该作者
Well done, Dear FOXAP, The main problem seems at the following sentence.You:Set xlsSheet = xlsApp.Workbooks(xlsApp.Workbooks.Count).Worksheets(1)文本44 = xlsSheet.Range("C4").TextMe文本44 = xlsApp.Range("C4").Text Can u give me the details of the difference? Mr.FoxXP?

点击这里给我发消息

9#
 楼主| 发表于 2004-12-13 23:06:00 | 只看该作者
foxxp老师:真棒!一切都非常好!谢谢您,谢谢楼上各位,从各位那里又学到不少东西!
8#
发表于 2004-12-13 19:46:00 | 只看该作者
帮你把函数修改了一下,看行不行?

用这段脚本覆盖窗体的update按纽的click事件.由于每天的上传文件有限,就不给你发文件了.

Private Sub cmdUpdate_Click()

Dim xlsApp As Excel.Application

Dim xlsSheet As Excel.Worksheet

With Me.OLE未绑定20

    .Action = acOLEActivate

    .Verb = acOLEVerbOpen

End With

Set xlsApp = GetObject(, "Excel.Application")

Debug.Print xlsApp.Workbooks.Count

Set xlsSheet = xlsApp.Workbooks(xlsApp.Workbooks.Count).Worksheets(1)

xlsApp.Visible = True

On Error GoTo handle:

文本44 = xlsSheet.Range("C4").Text

文本47 = xlsSheet.Range("C5").Text

文本49 = xlsSheet.Range("C6").Text

文本51 = xlsSheet.Range("C7").Text

文本53 = xlsSheet.Range("C8").Text

文本55 = xlsSheet.Range("C9").Text

文本57 = xlsSheet.Range("C10").Text

xlsApp.Visible = False

xlsApp.Quit

Set xlsApp = Nothing

文本44.Value = 文本44

文本47.Value = 文本47

文本49.Value = 文本49

文本51.Value = 文本51

文本53.Value = 文本53

文本55.Value = 文本55

文本57.Value = 文本57

Exit Sub

handle:

   Call MsgBox("错误信息" & Err.Number & ":" & Err.Description, , "错误")

   Resume Next

End Sub

点击这里给我发消息

7#
 楼主| 发表于 2004-12-13 17:45:00 | 只看该作者
多谢楼上斑竹、专家的指教。office重装了一下,找到了Microsoft Excel 9.0 Object Library,数据可以转移了。谢谢各位。但是还是必须按两次Update钮才行,按第一次还是出现“运行时错误,‘1004’    ‘Range‘作用于对象‘-Application‘时失败”,不知是什么原因。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-11-10 20:16 , Processed in 0.102443 second(s), 35 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表