你用什么方法打开EXCEL文件是SHELL函数还是调用CREATEOBJECT(EXECL.APPLICATION)?
解决方案 »
- 我写个定时关机程序要占17000K内存,有办法优化吗?
- !!!!急急急!!一个数据库表寻找记录判断问题!!!急急急!!!
- 如何从网页上下载数据
- 急!在线等!请教如何对文件进行读写操作?
- 有沒有辦法使水晶報表 CRViewer91 控件轉email時默認 MailMessage
- 如何在vb中同时看见窗体和数据环境?
- 请问:如何使执行后的程序 在按Ctrl+Alt+Del弹出的关闭程序列表中看不到?
- 请问DataGrid的背景颜色如何设置?
- 如何在网页中的文本框的右键上添加自定的信息
- 有没有uuencode的编码和解码控件?或者使用什么方法实现?
- CAB文件有缺陷???
- 在VB中,怎样对SQL进行事务处理?
我用的是CREATOBJECT方法,请问用SHELL方法如何实现,可否具体点,用CREATOBJECT方法为什么会存在该问题?
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Dim x As Long
Dim DataPath As String
DataPath = App.Path & "\mobs.xls"
x = ShellExecute(hwnd, "Open", DataPath, "", "", 1)
这样人工修改应该没有问题!
请问函数执行后返回的X是什么,如何用X对EXCEL文件中的中的数据进行操作,如何获得一个EXCEL文件中的某一SHEET的引用?
SHELLEXECUTE函数无法实现对某一SHEET的引用(只能打开默认的SHEET,一般是SHEET1)
这时只能用CREATEOBJECT调用对象了!
Returns a value greater than 32 if successful, or an error value that is less than or equal to 32 otherwise. The following table lists the error values. The return value is cast as an HINSTANCE for backward compatibility with 16-bit Windows applications. 0 The operating system is out of memory or resources.
ERROR_FILE_NOT_FOUND The specified file was not found.
ERROR_PATH_NOT_FOUND The specified path was not found.
ERROR_BAD_FORMAT The .exe file is invalid (non-Win32® .exe or error in .exe image).
SE_ERR_ACCESSDENIED The operating system denied access to the specified file.
SE_ERR_ASSOCINCOMPLETE The file name association is incomplete or invalid.
SE_ERR_DDEBUSY The DDE transaction could not be completed because other DDE transactions were being processed.
SE_ERR_DDEFAIL The DDE transaction failed.
SE_ERR_DDETIMEOUT The DDE transaction could not be completed because the request timed out.
SE_ERR_DLLNOTFOUND The specified dynamic-link library was not found.
SE_ERR_FNF The specified file was not found.
SE_ERR_NOASSOC There is no application associated with the given file name extension.
SE_ERR_OOM There was not enough memory to complete the operation.
SE_ERR_PNF The specified path was not found.
SE_ERR_SHARE A sharing violation occurred
非常感谢你的帮助,希望通过你的方法能解决问题,周一验证后给分.