Hi all,

I have wrote VBA code by export data into excel. But when i run it in some machine, an error occured. Error message is below:
"Run-time error '-2147024770 (8007007e)':
Automation error
The specified module could not be found."

Error occured in some compters only, not all.

Any one can help me? i will appreciate your help.

Chanthorn

email: bchanthorn@racha.org.kh

Could you please post your project? It will help us to help you solve your problem.

Yomet

hi,

my code are below:

'************************************
Dim xl As New Excel.Application
Dim wb As Workbook, ws As Worksheet

Set wb = xl.Workbooks.Open("C:\ODDatabase\ObjComponent\ExcelOrder.xlt")
Set ws = wb.Worksheets("HFInvoice")

'************************************

then error occured at Set wb = xl.Workbooks.Open("...")

this occured in few computers only, not all computers.

Thanks in advance.

You might want to try to

Dim xl As Excel.Application

Set xl = CreateObject("Excel.Application")

I am not sure of the exact syntax but it's along these lines. Let me look and I'll see what I can find - I know I have it somewhere.

Yomet

That's the syntax I was looking for.

Tell us how it goes

Yomet

i try them already, i think it might caused by windows or ms office.

still be the same

Hi BChanthorn,

I tried your code and everything works fine on my computer. Now the things I would check are the following:
- Does the Excel template exist on the problem computers? Usually you would get another error if it doesn't but I like going through all the possibilities.
- Does the Excel library have the same name on the problem computers, i.e. on my computer it is called "Microsoft Excel 9.0 Object Library". If the problem computers have different versions of Office installed this name changes, i.e. "Microsoft Excel 11.0 Object Library" for office XP (I think), this might be the problem you are having. The name might also change with different languages but I am not sure about this.

Look into this and post your findings.

Good Luck

Yomet

Thanks yomet for your hard,

I have checked all your solution already, but it still be the same.

Thanks any way

Are you using the setup wizard to create a setup and installing from it on all computers ? Or are you just copying the .exe and other files ? In the second case, there could be a problem of different .dll versions. Or are you copying the source code in all computers and running from VB in them ?

Also, I am sure you have checked this, but since you are hard-coding the path, please make sure that the directories and sub-directories are typed correctly.

Good thinking Aparnesh

Hi all,

I have wrote VBA code by export data into excel. But when i run it in some machine, an error occured. Error message is below:
"Run-time error '-2147024770 (8007007e)':
Automation error
The specified module could not be found."

Error occured in some compters only, not all.

Any one can help me? i will appreciate your help.

Chanthorn

email: bchanthorn@racha.org.kh

Hi Chantorn,

The computers that have Excel installed work and the ones that don't have Excel installed don't?
In other words: Is Excel installed on all computers you are using the script on?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.