|
-
Oct 9th, 2005, 11:05 PM
#1
Thread Starter
Lively Member
how to open excel file in microsoft access 2003?
Hi guys, why i got probelm open an excel file in microsoft access 2003?
please help.
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlWSheet As Excel.Worksheet
Set xlApp = New Excel.Application
xlApp.Workbooks.Open Filename:=Me.txtFilePath.Value
Set xlBook = xlApp.Workbooks
Set xlWSheet = xlBook.Worksheets(1)
when my code run until the open method, it come out error, of "application deined error or object-defined error".
i think Access 10 and Access 11 use different open method.
can anyone help or give a code snippet?
Last edited by kkc; Oct 11th, 2005 at 05:04 AM.
Reason: resolved
-
Oct 10th, 2005, 10:35 AM
#2
Re: how to open excel file in microsoft access 2003?
I take it that your trying to pass in a Access textbox objects value and not a vb6 one.
VB Code:
xlApp.Workbooks.Open Filename:=Form1!txtFilePath.Value
Also, if your trying to do an import you can use the .TransferSpreadsheet method to do it in one line of code.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 11th, 2005, 05:04 AM
#3
Thread Starter
Lively Member
Re: how to open excel file in microsoft access 2003?
actually my code is working, it is just that the file corrupted.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|