473,661 Members | 2,421 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Insert into Excel 2007 using ADO in VBA

2 New Member
Not sure what is going on. Trying to insert records into new worksheet using ADO command object, it runs fine, creates the new sheet and header row, but no data?? I have tried a few things, can get Select statements to run against the connection, can even update the data in the workbook using a "Update [test$] set [col1]='a' where [col1]='1'" " statement, but no luck with this. My operating system is vista and this code resides in an Excel 2007 vba module. Thanks

Code:

cnn_xls = "Provider=Micro soft.ACE.OLEDB. 12.0;Data Source=C:\Users \Owner\Document s\Data.xlsm;" & _
"Extended Properties=""Ex cel 12.0 Macro;HDR=YES;" ""

cnn.Open cnn_xls
cnn.Execute "Select * Into [test] from [data$]"
cnn.Close
Set cnn = Nothing
End Sub
Jul 25 '08 #1
1 9378
ccckidd
2 New Member
Never mind, I solved it myself, although I would like to know why this is: I was trying to "Select Into" in one worksheet in the workbook from another sheet in the same workbook. When I used the same data but in a different workbook:

cnn.Open "Provider=Micro soft.ACE.OLEDB. 12.0;Data Source=C:\Users \Owner\Document s\Test.xlsm;" & _
"Extended Properties=""Ex cel 12.0 Macro;HDR=YES;" ""


cnn.Execute "Select * Into [sheet1] from [C:\Users\Owner\ Documents\Data. xlsm].[tbl$]"

this works.
Jul 25 '08 #2

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

Similar topics

0
4124
by: Bill Fallon | last post by:
I am developing a VB.Net application with VS 2005 that opens an Excel workbook and populates the worksheet with data. I started developing the application with Office 2007 installed on my Vista OS, but after I discovered that it won't run on a system with Office 2003, I uninstalled Office 2007 and installed Office 2003. I reset the reference in .Net to the Microsoft Excel 11.0 Object Library. The application works fine from the ..Net...
0
1712
by: silverear | last post by:
Hello everybody, I have written an application that is running as an Office project within Excel in C#. I created a setup project for my tool. When I install my program on a machine that has Excel 2003 everything is fine. If there is only Excel 2007 the installation will fail. If there are both (Excel 2003 and 2007) installed, the installation is also ok. My tool is running fine with Excel 2007, but I can't install it on a machine...
2
8913
by: Ch Pravin | last post by:
Hi All: I am having the following xml which i need to convert to excel using xslt. Please help me out. Afghanistan.xml <?xml version="1.0" encoding="utf-16"?> <Languages BuildVersion="1,5,0815,0 " CountryName="Afghanistan" > <Language locale="English">
15
5342
by: =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?= | last post by:
Hi All, We are in the process of Upgrade Excel 2003 (Office 2003) to Excel 2007 (Office 2007) for one of web application. This web application is using Excel (Pivot Table) reports. With Excel 2003 application (Reports) works ok. But when Office 2003 is upgraded to Office 2007 Excel reports stops working. It Log the error “Exception from HRESULT: 0x800A03EC.” In database.
2
5185
budigila
by: budigila | last post by:
Hiya peeps, Okies, I have been trying to work this out for a while now to no avail... I am a beginner to this whole coding thing but have made great strides in my project. Basically what I am trying to do is to convert an .xml using a .xsl to and using a java script to output it into a readable format within excel. I have been able to successfully use a javascript to combine my .xml and .xsl but cannot figure out how to have it output to...
2
2935
by: RP | last post by:
I am exporting certain records to Excel 2007 using C# code. I want to adjust the cell width accordingly so that when the record gets transferred to a cell, it is clearly visible. I want to increase the height and width of the Excel cell at run-time.
3
20769
by: JFKJr | last post by:
Hello everyone, I am trying to insert a picture in an excel spreadsheet cell using Access VBA. The following excel VBA code is working perfectly fine and I am able to insert picture in "A1" cell. But with the following Access VBA code, I am getting "Type Mismatch" error at line #13. Please kindly let me know how to solve this issue. Thanks a million in advance! Excel VBA: Sub InsertPic()
5
48989
by: Doogie | last post by:
Can anoyne tell me why this VBScript will create the file to Excel just fine, but the Excel file will not open up? I am saving it as a xlsx file instead of an xls one and I have the new version of Excel on my machine and have opened other Excel files with that extension but this one I get the following error: "Excel cannot open the file 'Test.xlsx' because the file format or file extension is not valid. Verify that the file has not...
15
5243
by: OzNet | last post by:
I have a query (with calculated fields) in Access (2007) and the data changes depending on the dates and staff person selected. I need to produce a series of graphs based on the data in this query and it seems to me that Excel is far easier to create graphs than Access. When I use the Get External Data feature of Excel and the dialog box with the tables and queries appears, the query I need is not listed. Is this because the query has...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8754
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8542
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8630
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7362
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4177
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4343
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1740
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.