473,385 Members | 1,387 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,385 software developers and data experts.

Calling an Excel Customed Function Within MS Access

48
Hello once again...

I made a function in Excel. The function does some error checking within the Excel file.

To be easy for me, I want my code in MS Access to simply call the function in Excel.

I check this MS Support site: http://support.microsoft.com/kb/198571
I tried calling my function and it didn't work.

Here's my MS Access code:
Expand|Select|Wrap|Line Numbers
  1.     Dim oXL As Excel.Application    ' Excel Application
  2.  
  3.     Set oXL = CreateObject("Excel.application")
  4.     oXL.Workbooks.Open (sXclFilePath)
  5.     oXL.Application.ErrorCheck
  6.  
  7.     Set oXL = Nothing
  8.  
Here's my Excel code:
Expand|Select|Wrap|Line Numbers
  1. Public Sub ErrorCheck()
  2.  
  3.     MsgBox "Inside Excel function."
  4.     'Supposedly some error checking...
  5.  
  6. End Sub
  7.  
The contents of the ErrorCheck function (in Excel) is just the MsgBox for testing. But my code above displays this error:

"Object doesn't support this property or method"


What's wrong with my code above?
How to call Excel customed function within MS Access?


-= keirnus =-
May 12 '09 #1
3 2809
keirnus
48
nevermind...i thought it will take me long time to figure it out...

sharing my knowledge:
Expand|Select|Wrap|Line Numbers
  1.     With oXL
  2.         .Workbooks.Open (sXclFilePath)
  3.         .Workbooks(sXclFilePath).RunAutoMacros (xlAutoOpen)
  4.         .Application.Run ("ErrorCheck")
  5.         .Workbooks.Close
  6.     End With
  7.  
  8.  
May 12 '09 #2
NeoPa
32,556 Expert Mod 16PB
@keirnus
We like that attitude :)

PS. Would the following not work in place of your line #4 :
Expand|Select|Wrap|Line Numbers
  1. .Workbooks(sXclFilePath).ErrorChecking
May 12 '09 #3

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

Similar topics

3
by: Gal merom | last post by:
I would like to run a function of one access file from another access/excel file, How can i do that? For example: I want to write a procedure in Excel VB that will call another function in an...
11
by: Mr. Smith | last post by:
Hello all, My code can successfully open, write to, format and save several worksheets in a workbook then save it by a given name, close and quit excel. My problem is that if I try and do it...
1
by: Paul Smith | last post by:
I am trying to re-write and automate an existing procedure, using Excel as the controlling application. I can find code to handle the importing of data from a CSV file into an Access table, but...
8
by: Rob Kellow | last post by:
Hello, I'm working on an application for use within my company on our intranet that will be used to gather some information and store some of the info in a SQL Server database and the rest of the...
6
by: Thelma Lubkin | last post by:
I am trying to modify an Access form that allows a user to specify the information s/he needs from a census-type database. The form's code builds a SQL statement from the user's request, and...
1
by: Jaime Leivers | last post by:
Here's a median function in access that you can call in any query. You could change this to any excel function you wanted. Most people can find the windows help file that says how to call an excel...
5
by: cdun2 | last post by:
Hello, I'm a non_VBA coder who has been asked to update the following Function: ************************** Function EMAILER_REV_BY_ACCTCODE_MACRO() On Error GoTo RA_EMAILER_Err ...
6
by: rlntemp-gng | last post by:
I need to extract information from some Excel files but am stuck with part of it: As an example, I have the following Excel File that has 3 tabbed sheets: FileName: ...
5
ADezii
by: ADezii | last post by:
Periodically, the same or similar question appears in our Access Forum: How can I use Excel Functions within Access? For this reason, I decided to make this Subject TheScripts Tip of the Week. In...
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...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.