By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,097 Members | 1,161 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,097 IT Pros & Developers. It's quick & easy.

Visual Basic 6.0 Datagrid

P: 2
I have completed my development using a Datagrid in VB6. I need the users to be able to select all of the rows and columns (that were returned and displayed in the grid) so they can copy them to excel. At present, I can select each column by holding down the shift key to get all the columns, but I can not get the data to copy and paste into excel. Please help... thx
Mar 27 '07 #1
Share this Question
Share on Google+
3 Replies

P: 83
you can convert files from grid to excel by the following steps

1 add a microsoft excel library reference
2 declare the following
Dim a As New Excel.Application
Dim B As New Excel.Workbook

3. on a command click write
Set a = New Excel.Application
Set B = a.Workbooks.Add

4. and in a loop write

a.cells(i,j) = grid1.textmatrix(i,j)

5 thats it
Mar 28 '07 #2

P: 2
This response worked great!!! thx.....

Now, I have a NEW PROBLEM.

I had to change my project references from Microsoft ActiveX Data Objects 2.0 Library to the Microsoft ActiveX Data Objects 2.1 Library and my syntax for the database connection no longer works:

Set conn1 = New ADODB.Connection
strConn = "DSN=READ;UID=Me;PWD=MeMeMe;SERVER=read_serv;"
conn1.Execute strConn

The code blows up on the third line with the error: Runtime error '3704' operation is not allowed when the object is closed.

ANYBODY... SOMEBODY, pls help!
Mar 28 '07 #3

P: 16
try this one...

Set conn1 = New ADODB.Connection
strConn = "DSN=READ;UID=Me;PWD=MeMeMe;SERVER=read_serv;"
conn1.connectionstring = strConn
Mar 29 '07 #4

Post your reply

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