Results 1 to 5 of 5

Thread: VB CODE and Excel Book

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2006
    Posts
    3

    VB CODE and Excel Book

    Hi all,

    I’m a newbie and have no VB experience.
    I’m trying to learn how to import multiple complex Excel sheets into existing tables in MS SQL 2000 database.
    Is there any book that quickly walks me through VB CODE and Excel?

    I know there is not any easy way to do this, but any help or suggestion would be very nice

    Bets regards,

    Abrahim

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: VB CODE and Excel Book

    Start small - one small sheet (part of a larger one perhaps!), then work up to the larger ones.

    You need to look up automation (in the vba stuff).
    In vb, you'd need:
    createobject
    getobject

    To mimic Excel vba you'll also need:
    wrk as object 'set to a workbook
    sht as object 'set to the sheet you are working from
    rng as object 'useful as a range object.

    Also, when learning, try using excels record macro function to see how it works. Then copy the code and replace with proper objects (instead of the selection object).

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: VB CODE and Excel Book

    since your running SSQL Server and want to import Excel to it, you can use DTS (Data Transformation Services) to import/export to and from Excel very easily.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2006
    Posts
    3

    Re: VB CODE and Excel Book

    Very helpful info!
    I have been using DTS, but the problem is that the Excel work sheet containing data has the column’s format set vertically, for example:
    Exam1:
    First_name : Jim
    Last_name: Smith
    Address: San Jose

    Exam2:
    But in standard format it supposed to be like:
    First_name Last_name City
    Jim Smith San Jose

    I don’t think you can use DTS to import Exam1: format into the Database.

    Is there any book for the beginner like me to start with?

    Thanks in advance,

    Abrahim

  5. #5
    Addicted Member
    Join Date
    Jan 2006
    Location
    Montreal, Canada
    Posts
    152

    Re: VB CODE and Excel Book

    You can use transpose(copy/pasteSpecial) to obtain your standard format and then import it using DTS

Posting Permissions

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



Click Here to Expand Forum to Full Width