473,322 Members | 1,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

MS Access VBA "Automation Error"

119 100+
I have the following vba code that returns the "date modified" field from a file, specified in filepath:

Expand|Select|Wrap|Line Numbers
  1. Function GetFileModifiedDate(filepath As String) As Date
  2.  
  3.     Dim fs, f
  4.     Set fs = CreateObject("Scripting.FileSystemObject")
  5.     Set f = fs.GetFile(filepath)
  6.  
  7.     GetFileModifiedDate = f.datelastmodified
  8.  
  9. End Function
On one machine it runs without any problems, but on another I encounter the following error message:

Expand|Select|Wrap|Line Numbers
  1. Run-time error (8007007e) 
  2. Automation error 
  3. The specified module could not be found.
Does anyone know how to fix this?

Thanks,
May 19 '08 #1
9 21248
ADezii
8,834 Expert 8TB
I have the following vba code that returns the "date modified" field from a file, specified in filepath:

Expand|Select|Wrap|Line Numbers
  1. Function GetFileModifiedDate(filepath As String) As Date
  2.  
  3.     Dim fs, f
  4.     Set fs = CreateObject("Scripting.FileSystemObject")
  5.     Set f = fs.GetFile(filepath)
  6.  
  7.     GetFileModifiedDate = f.datelastmodified
  8.  
  9. End Function
On one machine it runs without any problems, but on another I encounter the following error message:

Expand|Select|Wrap|Line Numbers
  1. Run-time error (8007007e) 
  2. Automation error 
  3. The specified module could not be found.
Does anyone know how to fix this?

Thanks,
  1. Set a Reference to the Microsoft Scripting Runtime Library.
  2. Rename your Function to:
    Expand|Select|Wrap|Line Numbers
    1. GetFileModifiedDate_2
  3. Modify the Function code to:
    Expand|Select|Wrap|Line Numbers
    1. Function GetFileModifiedDate_2(filepath As String) As Date
    2.  
    3. Dim fs As FileSystemObject
    4. Dim f As File
    5.  
    6. Set fs = CreateObject("Scripting.FileSystemObject")
    7. Set f = fs.GetFile(filepath)
    8.  
    9. GetFileModifiedDate_2 = f.DateLastModified
    10. End Function
  4. Let me know how you make out.
May 20 '08 #2
billelev
119 100+
Thanks for your reply. I tried what you suggested but with no success. Given that the original code worked on one machine, but not the other. Would this not imply that the issue is with the machine, rather than the code?
May 20 '08 #3
ADezii
8,834 Expert 8TB
Thanks for your reply. I tried what you suggested but with no success. Given that the original code worked on one machine, but not the other. Would this not imply that the issue is with the machine, rather than the code?
Given that the original code worked on one machine, but not the other. Would this not imply that the issue is with the machine, rather than the code?
It would appear that way. I was almost sure that 1 of the three suggestions would have solved the problem, but obviously not (LOL). I'll put my Thinking Cap on again and get back to you if I arrive at a solution.
May 20 '08 #4
NeoPa
32,556 Expert Mod 16PB
When it said "The specified module could not be found.", were there any clues as to what the module referred to might be?
May 21 '08 #5
billelev
119 100+
No, although it has to be associated with the code above...

I have spent a lot of time searching for a solution on the internet, and this is certainly not an isolated problem. Many people have had similar issues, with seemingly good code not working on one particular machine.

One such post is ** Link removed as per site rules **

Unfortunately, none of the forums I have visited have a posted solution!
May 21 '08 #6
NeoPa
32,556 Expert Mod 16PB
Please remember not to link to other forum sites in your posts. I'm sure this was innocently done, but not allowed nevertheless.

As for Access error messages, although they can sometimes be helpful, they are also quite famous for being completely unrelated to the issue (as in - entirely spurious).

This can be particularly annoying when you find the solution which you only failed to find before because the error message actually indicated something completely different was at the root of the problem.
May 21 '08 #7
billelev
119 100+
Okay, it seems that there was some kind of problem with scrun.dll.

I tried registering the dll again, using:

Expand|Select|Wrap|Line Numbers
  1. regsvr32 C:\WINDOWS\System32\Scrrun.dll
in the CMD prompt. It is now working...

Thanks for all your input.
May 21 '08 #8
NeoPa
32,556 Expert Mod 16PB
Excellent :) Thanks for posting that.

Just for general usage it can also be used as :
Expand|Select|Wrap|Line Numbers
  1. regsvr32 %WinDir%\System32\Scrrun.dll
May 21 '08 #9
Hi billelev,
Thanks...
It really worked...
Oct 21 '10 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Robert | last post by:
---EN--- This message has been crossposted in a french speaking newsgroup, english version is at the end. Thanks a lot for your help... --/EN--- Bonjour, Je développe une application...
0
by: Jon Rista | last post by:
Hello. I'm trying to automate Excel in a C# Windows Service. This windows service has to be able to access files on network shares, so it uses a domain account on a WinNT 4.0 domain server, rather...
1
by: Ueslei R. Valentini | last post by:
Hi! Does anyone figured out this error when trying to create a new page in a web project under Windows2003, using Visual Studio .Net 2003? "Automation server can't create object " HSH Ueslei
4
by: Bill Coan | last post by:
NOTE: This was posted earlier to vsnet.vstools.office under a different subject line but received no response. I'm having a problem automating Word's Find object from a .NET application, using...
1
by: drk.kumar | last post by:
I have an implementation issue with WMI scripts to check the user machine processor. The implementation is working fine in the local machine (Windows XP operating system). It is throwing script...
3
by: gazelle04 | last post by:
I wanted to create a subfolder in a directory and I used the MkDir statement but it gives me an error like "Path/File access error" Here are the codes: MkDir "\\BC123456\Attachments\" &...
3
by: Mac Campbell | last post by:
For some unknown reason my mdb seemed to drop a module I had named "Utilities". I tried to copy the module back in from a backup copy and got the error message "<<MyProject>> is currently unable to...
2
by: hdroogendyk | last post by:
Folks: I'm an Access newbie, trying to modify an existing application and running into an error that I don't understand. A tree view control is being loaded from an Access table and the "on...
0
by: dim505 | last post by:
hi friends, I'm new to this forum. I have created and build a dll but at first it was getting the error"Automation server can't create object" after a lot of head ache,I got the script...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.