如何使用vb6从excel导入数据到SQL Server DB? [英] How import data from excel to SQL server DB using vb6?

查看:99
本文介绍了如何使用vb6从excel导入数据到SQL Server DB?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这个项目中,我正在使用Excel.application的一个对象来打开excel表,但是当我调试代码时,我在执行'obj.workbooks.open(< path>)'时遇到错误 - 错误是此操作无法完成,因为其他应用程序正忙。选择开关以激活繁忙的应用程序并更正问题

有人请帮助。



我尝试过:



设置objExcel = CreateObject(Excel.Application)

设置xlWB = onjExcel.Workbooks.open(xl)

- 其中xl是一个存储扩展名为excel文件路径的变量。

In this project I’m using an object of Excel.application, to open the excel sheet but when I debug the code, I’m getting an error while executing ‘obj.workbooks.open(<path>)’ - and the error is "This action cannot be complete because the other application is busy. Choose switch to activate the busy application and correct the problem"
Someone please help.

What I have tried:

Set objExcel= CreateObject("Excel.Application")
Set xlWB = onjExcel.Workbooks.open(xl)
- where xl is a variable which stores my excel file path with extension.

推荐答案

假设使用 onjExcel 这里只是一个拼写错误而不是你的代码,它可能是Excel显示某种对话框或消息。



Assuming that use of onjExcel is just a typo here and not in your code, it''s likely that Excel is showing some sort of dialog box or message.

Put a breakpoint on
Set xlWB = objExcel.Workbooks.open(xl)

并切换到Excel应用程序并查看。



你可能已经开放了其他Excel的东西 - 试着关闭那些实例。



有时重新启动可以提供帮助 - 或者使用任务管理器确保在尝试再次运行程序之前确实已从内存中清除所有Excel实例。



参见此 Microsoft支持文章 [ ^ ]

and switch to the Excel application and have a look.

You may possibly have Excel open already for something else - try closing those instances if so.

Sometimes rebooting can help - or use Task Manager to ensure that all instances of Excel are indeed cleared from memory before trying to run your program again.

See also this Microsoft support article[^]


这篇关于如何使用vb6从excel导入数据到SQL Server DB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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