Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 5th, 2014, 01:41 AM
Registered User
 
Join Date: Sep 2014
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Extracting a Table from SQL to Excel Using VB Scripting

Hi,

I am new to this type of forums. I am not sure if i should be asking this are not. Or even if i am asking at the right place. If i have made a mistake you can delete the thread if u want to.

I need to do a VB Scripting in Excel Worksheet such for the following process.

User will enter a string in the Text field. And clicks a button.

When the button is clicked the vb script should match the string to a column in a View in SQL Server and return the corresponding datas which have the same value as the textfield.

For example

The following is the data found in the SQL View

Product Type Qty Date
Mango Indian 20 9/5/2014
Apple Fuji 30 7/5/2014
Mango Thailand 40 8/5/2014


In the Excel sheet when the user enters Mango in the text field and clicks the Button the following data should be displayed in the Excel sheet.

Product Type Qty Date
Mango Indian 20 9/5/2014
Mango Thailand 40 8/5/2014


I am good in C++. I can easily do this using Gui forms and ASP.NET. But i dont know VB. But i need this to be done in Excel VB as the users wants it in Excel. So can Someone please Help.


Thanks,

Ramya

Last edited by ramya1389; September 5th, 2014 at 01:52 AM..
 
Old September 5th, 2014, 01:52 AM
Registered User
 
Join Date: Sep 2014
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If it will make things easier, I can extract the whole data from SQL and place it in the Excel using Data extract in a seperate sheet. And then from there it is possible to the VB scripting for the above process. Instead of connecting to SQL and retrieving data from there.

I hope this might make it easier for you. Thanks for the help.
 
Old November 4th, 2014, 12:49 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi Ramya

It would've been much simpler if you connect from .NET to SQLServer / Oracle . Excel also does more or less the same

The following link should be useful for your requirement

http://www.mdobie.co.uk/2012/11/14/q...ith-excel-vba/

To extract data from SQL Server Table to Excel

http://office.microsoft.com/en-in/ex...010217956.aspx


If you want to use Excel as a Database (Table). Refer the link below

http://vbadud.blogspot.in/2008/05/us...-database.html



Regards
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel data to SQL table rmarieh3431 BOOK: Beginning ASP.NET 4 : in C# and VB 1 April 21st, 2012 02:35 PM
Export SQL table to excel avidan BOOK: Beginning ASP.NET 4 : in C# and VB 2 September 18th, 2011 11:53 AM
VB Scripting namitas Visual Basic 2008 Professionals 0 June 12th, 2008 08:58 AM
dos scripting in excel vb noideawhatimdoing Beginning VB 6 0 December 5th, 2004 02:08 PM
Convert SQL table to Excel in VB. anita Pro VB Databases 1 May 13th, 2004 04:58 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.