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

  • SEARCH
  • Home
  • 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 7521295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:12:44+00:00 2026-05-30T02:12:44+00:00

I use Access 2007, SQL Server 2005 and 2008, and C#.net with VS20010. I

  • 0

I use Access 2007, SQL Server 2005 and 2008, and C#.net with VS20010.

I need to validate, then import an Excel workbook that has been posted to a SP document library. I wrote the program using VBA in A2k7 so I could get it working, get all my thoughts together, etc. Shortly, I’m going to start converting it to C# so I can run it on a scheduled basis from my SQL Server agent. Authentication may be fun, we’ll see.

In my Access VBA program, I use a simple statement to create a multi-dimensional array of “variants”. This allows me to test every single cell for the correct type before I try to assign it to a local variable. Certain cells must be numeric. Others, I use as strings, even if they’re numeric. Since the data may be hand-entered, I could see virtually any content in the cells…one of the reasons I don’t just import it, since most import vehicles (ACCESS, SSIS) use Excel’s determination as to the column’s “type”.

    '
'   Get the range of used cells from the worksheet and stuff it into an array
'
xlApp.visible = False                   'Don't let the workbook be shown
Set xlWB = xlApp.Workbooks.Open(URL)    'Open the workbook
Set xlSH = xlWB.Worksheets(1)           'Must be the first worksheet in the workbook
HandleMessages 1, 0, 1, "Working on Workbook " & xlWB.NAME & ", Worksheet " & xlSH.NAME
Set xlRA = xlSH.UsedRange               'xlRA is the range of cells in the first workbook that are "USED"
strSheetArray = xlRA                    'This sets an array of variants to the two dimensional range xlRA

So, going to C#, what do I do about the lack of a non-typed “variant”? How do I proceed? Anyone done it?

  • 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-05-30T02:12:44+00:00Added an answer on May 30, 2026 at 2:12 am

    You can use dynamic in C# 4.0.

    http://msdn.microsoft.com/en-us/library/dd264736.aspx

    The type is a static type, but an object of type dynamic bypasses
    static type checking. In most cases, it functions like it has type
    object. At compile time, an element that is typed as dynamic is
    assumed to support any operation. Therefore, you do not have to be
    concerned about whether the object gets its value from a COM API, from
    a dynamic language such as IronPython, from the HTML Document Object
    Model (DOM), from reflection, or from somewhere else in the program.
    However, if the code is not valid, errors are caught at run time.

    The link shows examples of using dynamic with Excel.

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

Sidebar

Related Questions

I have an Access 2007 Project with a SQL Server 2005 backend. However, when
I'm using Access (2003 format) as a front-end with a SQL Server 2008 backend.
I want to use Access database with query for pivot table in Excel. How
best solution for use access in project for database with security i need to
can you use ms access as the backend of a asp.net dynamic data project
We have a SQL server database. To manipulate the data non-programmatically, I can use
Can I use access 2007 VBA references with impunity (specifically, as far as the
I have tried to use ENUMS in my code for Access 2007. But it's
Here's the query that is being executed on SQL Server 2008: SELECT "dbo"."tblMainData"."recID" FROM
I'd like to use a .png as a custom icon in the Access 2007

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.