+ Reply to Thread
Results 1 to 11 of 11

Not able to paste recordset in excel spreadsheet

Hybrid View

pratik4891 Not able to paste recordset... 02-17-2016, 05:43 AM
grimes0332 Re: Not able to paste... 02-17-2016, 05:44 AM
pratik4891 Re: Not able to paste... 02-17-2016, 05:49 AM
grimes0332 Re: Not able to paste... 02-17-2016, 05:52 AM
pratik4891 Re: Not able to paste... 02-17-2016, 05:57 AM
grimes0332 Re: Not able to paste... 02-17-2016, 06:05 AM
pratik4891 Re: Not able to paste... 02-17-2016, 06:17 AM
pratik4891 Re: Not able to paste... 02-17-2016, 06:15 AM
grimes0332 Re: Not able to paste... 02-17-2016, 06:25 AM
pratik4891 Re: Not able to paste... 02-17-2016, 06:31 AM
pratik4891 Re: Not able to paste... 02-17-2016, 10:49 AM
  1. #1
    Registered User
    Join Date
    11-11-2013
    Location
    pune
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Not able to paste recordset in excel spreadsheet

    No issues , thanks .

  2. #2
    Registered User
    Join Date
    11-11-2013
    Location
    pune
    MS-Off Ver
    Excel 2003
    Posts
    8

    Red face Re: Not able to paste recordset in excel spreadsheet

    Not the smartest query but this will work in case anyone has the same problem
    Sub Button1_Click()
    Dim cnn As ADODB.Connection
       Set cnn = New ADODB.Connection
    
    
    Dim Cmd1 As New ADODB.Command
    Dim ReturnArray As DAO.Recordset
    Dim mrs As New ADODB.Recordset
    Dim rsTest As ADODB.Recordset
    Dim DBPath As String, sconnect As String
    
       ' Open a connection using an ODBC DSN "Pubs".
       cnn.ConnectionString = "DSN=XXX;UID=XXX@xxx.com;PWD=xxxx;"
       cnn.Open
    
       ' Find out if the attempt to connect worked.
       If cnn.State = adStateOpen Then
          MsgBox "Echo!"
       Else
          MsgBox "Sorry."
       End If
       
           Cmd1.ActiveConnection = cnn
           Cmd1.CommandText = "sql query"
           mrs.Open Cmd1
           
           
    
     If Not mrs.EOF Then
            Sheets("Sheet2").Range("A1").CopyFromRecordset mrs
        End If
    
    mrs.Close
    
       ' Close the connection.
       cnn.Close
    End Sub
    Any improvements/suggestions are most welcome.

    Thanks,

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Open another recordset within current recordset vba
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-02-2015, 04:32 AM
  2. Paste recordset on next empty row inside a table
    By baijixu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-22-2014, 03:13 PM
  3. Recordset cross referencing spreadsheet data not updating missing values
    By Sc0tt1e in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-20-2013, 08:36 AM
  4. Automated find and paste URL in Excel Spreadsheet
    By chattemer in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-14-2013, 03:29 PM
  5. [SOLVED] Excel won't let me cut and paste a jpeg into the spreadsheet.
    By RickS in forum Excel General
    Replies: 1
    Last Post: 03-09-2006, 02:22 PM
  6. [SOLVED] Recordset's RowID as part of Recordset
    By Trip in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-22-2005, 06:55 PM
  7. Replies: 1
    Last Post: 09-20-2005, 07:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1