473,770 Members | 3,983 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help with opening excel worksheets and text files

Hi friends

I need routines to create an excel file with worksheets for each
customer and a text file as well for each customer, first worksheet
would be a "Summary Report", here is the code that would get the data
for me I would appreciate if someone can add routines to create excel
and text files to it, the columns in text file need to be "|"
separated - thanks ever so much for all the help I have been getting
from this wonderful forum :

---Code---

If PostgreSQLADOCo nnection() Then

Dim objIdADO As ADODB.Recordset
dim objOrdAdo As ADODB.Recordset
Dim sqlStrID As String
Dim sqlStrOrders as string

Set oConn = CurrentProject. Connection
Set cn = cPostgreSQL

sqlStrID = "SELECT id FROM tblCustomers order by id"
Set objIdADO = cPostgreSQL.Exe cute(sqlStrID)

Do While Not objIdADO.EOF

'Here I need the code to open worksheets for each customer
id as the name and also a text file
'Then print some heading and adding some formatting to both
excel worksheet and text file

sqlStrOrders = "SELECT order_id, qty, unit_price, amount
FROM tblOrders WHERE customer_id = " & objIdADO("id")
Set objOrdAdo = cPostgreSQL.Exe cute(sqlStrOrde rs)

Do While Not objOrdADO.EOF

'Here I need the code to print orders recordset to
customers worksheet and textfile
'At the end of the reports sum of amount

objOrdADO.MoveN ext
Loop

objIdADO.MoveNe xt
Loop
Set objIdADO = Nothing
Set objOrdADO = Nothing
Set cPostgreSQL = Nothing
End If

---Code---
Nov 12 '05 #1
1 1944
mr****@hotmail. com (mr_ocp) wrote in message news:<7e******* *************** ****@posting.go ogle.com>...
Hi friends

I need routines to create an excel file with worksheets for each
customer and a text file as well for each customer, first worksheet
would be a "Summary Report", here is the code that would get the data
for me I would appreciate if someone can add routines to create excel
and text files to it, the columns in text file need to be "|"
separated - thanks ever so much for all the help I have been getting
from this wonderful forum :


One thing you could do is transfer the recordset from Access directly
to Excel, and then save using automation maybe.

For writing the thing to a text file, see Open/Write/Close etc. You
could just walk the columns collection of the recordset for each
record and write that value to a string variable and just throw in
your delimiter between each column value.
Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
363
by: David Krmpotic | last post by:
hi!! I use the following code to operate excel document: Excel.Application excelApp = new Excel.ApplicationClass(); //excelApp.Visible = true; string workbookPath = "c:\\eltina.xls"; Excel.Workbook excelWorkbook = excelApp.Workbooks.Open("eltina.xls",0,false,5,"","",false,Excel.XlPlatform.
3
20286
by: Otie | last post by:
I found the following under the GetObject help notes and in the example for GetObject: "This example uses the GetObject function to get a reference to a specific Microsoft Excel worksheet (MyXL). It uses the worksheet's Application property to make Microsoft Excel visible, to close it, and so on. Using two API calls, the DetectExcel Sub procedure looks for Microsoft Excel, and if it is running, enters it in the Running Object Table. The...
1
259
by: mr_ocp | last post by:
Hi friends I need routines to create an excel file with worksheets for each customer and a text file as well for each customer, first worksheet would be a "Summary Report", here is the code that would get the data for me I would appreciate if someone can add routines to create excel and text files to it, the columns in text file need to be "|" separated - thanks ever so much for all the help I have been getting from this wonderful forum...
5
8037
by: Iris | last post by:
I have 8 text files (tab delimited) that I would like to import into an Excel workbook as 8 individual worksheets but I cannot find any example code on this subject. Can anyone help me please???? Thanks in advance. Regards,
4
4390
by: Powerguy | last post by:
Hi all, I've spent countless hours trying to get this silly EXCEL process to close once I have used it. If anyone can help it would really REALLy be appreciated! Below is my code- Dim t As Integer Dim testCount As Boolean testCount = False For t = 0 To UserListView.Items.Count - 1
3
4012
by: dan_roman | last post by:
Hi, I developed a script with a nice interface in Tkinter that allows me to edit some formulas and to generate an Excel worksheet with VBA macros within it. The script runs perfectlly in Office 2000, but in Office 2003 crash at line: "wbc = workbook.VBProject.VBComponents.Add(1)" Please help me :-( the code of the module that crash is (only in Excel 2003, in 2000 not): import os
9
3944
by: pic078 via AccessMonster.com | last post by:
I need serious help - I have a frontend/backend Access database (2 MDE Files) that remains stuck in task manager after exiting the application - you can't reopen database after exiting as a result - I have read every post out there and spent hours trying to figure out the problem with no success whatsoever - I have constrained the problem to one form however, and I think it's hiding somewhere in my code associated with this form, which is...
10
3118
by: Esmael | last post by:
Hi to all, /*****************************/ OS-WIn XP SP2 VB6 SP6 /*****************************/ Is their anyone who can help me with this: Source code written on VB6.
3
6803
by: blerina | last post by:
hi, i have a simple asp code that opens an excel file. it works fine with simple excel files that don't contain formula. i think the problem is that my excel file contains formulas and calculations. when opening this file with vb 6.0 code it works fine. here is a the simple code: Dim xlObject, xlBook,wks
0
10228
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
10057
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
10002
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
9869
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
8883
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 project—planning, coding, testing, and deployment—without 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
7415
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
5312
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
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3970
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.