Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8248763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:18:15+00:00 2026-06-07T23:18:15+00:00

I have created the macro below in Microsoft Excel 2003 on a windows XP

  • 0

I have created the macro below in Microsoft Excel 2003 on a windows XP 32 bit machine, when I press the refresh button my spreadsheet populates as it should.

However when I run this on the users machine which are windows 7 machines, both 32 bit and 64 bit i get the following error message

“Run-time error ‘-2147467259 (80004005)’:
[Microsoft][ODBC Driver Manager] Data source name not found an no default driver specified”

Private Sub CommandButton1_Click()
    Dim cmd As New ADODB.Command
    Dim conn As ADODB.Connection
    Dim prm As ADODB.Parameter
    Dim strConn As String
    Dim strSQL As String
    Dim Rst As ADODB.Recordset
    Dim WSP As Worksheet
    Dim lastRow As Long
    Dim ranges As range



 strConn = "Data Source=;Initial Catalog=;User Id=;Trusted_Connection=False;"
    Set conn = New ADODB.Connection
    Set WSP = Worksheets("KPI")

    lastRow = WSP.Cells.SpecialCells(xlCellTypeLastCell).Row
    Set ranges = WSP.range("A6", WSP.Cells(lastRow, "K"))
    ranges.Clear

    conn.Open strConn

    Set cmd = New ADODB.Command
    cmd.CommandText = "dbo.returns_kpi_data"
    cmd.CommandType = adCmdStoredProc
    cmd.ActiveConnection = conn

    cmd.Parameters.Refresh
    cmd.Parameters("@OrderDate1").Value = WSP.range("G3", "G3")
    cmd.Parameters("@OrderDate2").Value = WSP.range("I3", "I3")


    'Execute the Stored Procedure
    Set Rst = cmd.Execute

    range("A6").CopyFromRecordset Rst


    'Close the connection
    conn.Close
End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T23:18:17+00:00Added an answer on June 7, 2026 at 11:18 pm

    I am guessing that you are connecting to SQL Server. In obfuscating the connection string, you have removed any information that could be used to properly identify the problem. I suspect that you may be using a DSN on the other PCs because you do not even have a provider in that string. You can get information on connection strings here: http://www.connectionstrings.com/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a macro enabled Excel Spreadsheet that will programmatically load a image
I have created a macro for excel which will pop up form that contains
I have created a macro that opens a excel workbook and performs some operations
I'm having trouble obtaining data with a macro I've created using XSLT. I have
i have a server where resides an excel macro there will be about 10
I have created a xlt excel template which works fine in Excel 2007 under
I have a VB macro created. I want to pass the macro a string
I have created a macro to make reserve memory for my strings in C
In Open office I have created a macro for printing documents. sub printDoc(FileName) Dim
I have created customized menu and toolbar in MS Excel. I wanted to show

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.