将Access表导入到Excel时找不到可安装的ISAM [英] Could not find installable ISAM when importing Access table to Excel

查看:415
本文介绍了将Access表导入到Excel时找不到可安装的ISAM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个将Access表导入到MS Office Excel的模块. 该模块已经实施了将近6个月,并且运行良好,但是昨天突然该模块开始发出错误消息外部表未采用预期格式"

I have a module that imports an Access table to MS Office Excel. This module has been implemented for almost 6 months and has worked well, but suddenly yesterday the module started giving an error message "External table is not in expected format"

我已经通过该网站搜索了答案,发现对于Excel 2007,我必须使用语法"Excel 12.0"而不是"Excel 8.0".我更改了脚本,并收到了新的错误消息: 找不到可安装的ISAM" (下面的代码)

I've searched the answer through this site and found that for Excel 2007 I must use syntax "Excel 12.0" not "Excel 8.0". I changed my script and got a new error message: "Could not find installable ISAM" (code below)

其他信息: 我尝试打开创建的Excel文件并收到警告消息:
您尝试打开的文件'bppdan.xls'的格式与文件扩展名指定的格式不同.在打开文件之前,请确保该文件未损坏且来自受信任的来源.要立即打开文件?"

Others information: I try to open the excel file created and got warning message:
"The file you are trying to open, 'bppdan.xls', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?"

所以...我决定修改代码(如下所示),但没有收到错误消息外部表不是预期格式"或找不到可安装的ISAM" 我真的很想知道导致这两个错误消息的原因

So... I decided to modify the code (shown below) and I'm not getting the error message "External table is not in expected format" nor "Could not find installable ISAM" I really want to know what cause that two error message

我真的需要你的帮助

(In VB 6 Application) In menu: Project -> References, I checked the option "Microsoft Excel 12.0 Object Library"

(In VB 6 Application) In menu: Project -> References, I checked the option "Microsoft Excel 12.0 Object Library"

此代码生成外部表未采用预期格式"

This code generate "External table is not in expected format"


    Dim dbDest As Database

    FName = ExcelApp.GetSaveAsFilename(, "Excel (*.xls),*.xls", , "Save to Excel")
    If FName = False Then Exit Sub
    Set dbDest = OpenDatabase(FName, False, False, "Excel 8.0;HDR=NO;")

此代码生成找不到可安装的ISAM"

This code generate "Could not find installable ISAM"


    Dim dbDest As Database

    FName = ExcelApp.GetSaveAsFilename(, "Excel (*.xls),*.xls", , "Save to Excel")
    If FName = False Then Exit Sub
    Set dbDest = OpenDatabase(FName, False, False, "Excel 12.0;HDR=NO;")

我已经修改了代码:


    Dim dbDest As Database

    FName = ExcelApp.GetSaveAsFilename(, "Excel (*.xls),*.xls", , "Save to Excel")
    If FName = False Then Exit Sub
    Set dbDest = OpenDatabase("C:\Users\administrator\Desktop\my.xls", False, False, "Excel 8.0;HDR=NO;")

推荐答案

最后,我们的高级开发人员拥有解决方案(yippie!) 她就是这样做的:

Finally, our senior developer has the solution (yippie!) This is what she does:

  1. 她修改了准备工作表的代码,添加了文件格式
    因此,代码会更改为
  1. She modified the code for preparing the worksheet, she add file format
    So the code changes from

Set ExcelWkb = ExcelApp.Workbooks.Add
ExcelWkb.SaveAs FName

Set ExcelWkb = ExcelApp.Workbooks.Add
ExcelWkb.SaveAs FName

成为

Set ExcelWkb = ExcelApp.Workbooks.Add
ExcelWkb.SaveAs FName, xlExcel5

becomes

Set ExcelWkb = ExcelApp.Workbooks.Add
ExcelWkb.SaveAs FName, xlExcel5

  1. 她修改了连接代码 因此,代码会更改为
  1. She modified the code for connecting So the code changes from

Set dbDest = OpenDatabase(FName, False, False, "Excel 8.0;HDR=NO;")

Set dbDest = OpenDatabase(FName, False, False, "Excel 8.0;HDR=NO;")

成为

Set dbDest = OpenDatabase(FName, False, False, "Excel 5.0;")

Set dbDest = OpenDatabase(FName, False, False, "Excel 5.0;")

这篇关于将Access表导入到Excel时找不到可安装的ISAM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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