I am already using the MS Excel 9.0 Object Library reference, so I did suggestion two and it works like a champ. So, thanks again, John.
As an author maybe you would be interested in a need I see in vba programmer land, and that would be a vba oriented beginning text where one could go to get just this type of information in one book on Office vba. Excel and Outlook have lots written about them, but Word is little (and then cryptically) addressed. I have an Excel book on vba in front of me and it does not even seem to touch on passing anything other than variables and static values to functions. I have yet to find a text that inter-relates Office data choices. Right now I am writing a little piece that reads Excel files in a single directory into an Access table. Thanks to Web sharing like on this site I am able to find resources to load and use Excel files via vba code in Access. Books I have found are all reliant on somebody setting up a data link off the files menu. Boo! Hiss!! Anyways, thanks and there's two of my cents. --- In [email protected], "John Viescas" <[EMAIL PROTECTED]> wrote: > > How do you have the object Dim'd in the first three lines of code? You > could simply pass it as an Object: > > Function Get_Columns_and_Rows( ... , ExcelDoc As Object) As Integer > > Or you could load a reference to the Excel library and declare it > Excel.Workbook. > > John Viescas, author > Building Microsoft Access Applications > Microsoft Office Access 2003 Inside Out > Running Microsoft Access 2000 > SQL Queries for Mere Mortals > http://www.viescas.com/ > (Paris, France) > For the inside scoop on Access 2007, see: > http://blogs.msdn.com/access/ > > _____ > > From: [email protected] > [mailto:[EMAIL PROTECTED] On Behalf Of wharmon97 > Sent: Wednesday, July 05, 2006 6:31 PM > To: [email protected] > Subject: [MS_AccessPros] How to pass an Excel object as a parameter of a > function in vba > > > > I have a vba function "Get_Columns_and_Rows" to which I would like to > pass an Excel object defined as > > strExcelDoc = "C:\Documents and Settings\wharmon\Desktop\Rapid ILL > for Will\B200507.xls" > Set ExcelDoc = ExcelApp.Workbooks.Open(strExcelDoc) > > My function: > > Function Get_Columns_and_Rows(ByRef intRow As Integer, ByRef intCol > As Integer, ExcelDoc) As Integer > On Error GoTo Err_Get_Columns_and_Rows > > .... > > So, anyone know how to reference the Excel object (ExcelDoc) as a > function parameter? > > > > > > > [Non-text portions of this message have been removed] > ------------------------ Yahoo! Groups Sponsor --------------------~--> Something is new at Yahoo! Groups. Check out the enhanced email design. http://us.click.yahoo.com/SISQkA/gOaOAA/yQLSAA/q7folB/TM --------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/ms_access/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
