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 8900071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:01:00+00:00 2026-06-15T01:01:00+00:00

So i recently turned Option Strict On in my current project and after fixing

  • 0

So i recently turned Option Strict On in my current project and after fixing all of the small errors that option throws i bumped into this one.

Public Sub ExportarExcel(ByVal grilla As DataGridView)

    Dim excelApp As Excel.Application
    Dim workbook As Excel.Workbook
    Dim sheet As Excel.Worksheet
    Dim i As Integer = 1
    Dim j As Integer = 1
    excelApp = CType(CreateObject("Excel.Application"), Excel.Application)
    workbook = excelApp.Workbooks.Add
    sheet = CType(workbook.Worksheets.Add, Excel.Worksheet)

    For Each col As DataGridViewColumn In grilla.Columns
        sheet.Cells(1, i).Borders.LineStyle = Excel.XlLineStyle.xlContinuous 'Problematic line
        sheet.Cells(1, i) = col.HeaderText
        i = i + 1
    Next
    i = 2

    For Each row As DataGridViewRow In grilla.Rows
        j = 1
        For Each cell As DataGridViewCell In row.Cells
            sheet.Cells(i, j).Borders.LineStyle = Excel.XlLineStyle.xlContinuous 'Problematic line
            sheet.Cells(i, j) = cell.Value
            j = j + 1
        Next
        i = i + 1
    Next

    sheet.Columns.AutoFit()
    excelApp.Visible = True
End Sub

Those two lines (from the start to “Borders.”) are throwing a late binding error and i’m not sure which is the proper cast or fix for those lines.

  • 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-15T01:01:02+00:00Added an answer on June 15, 2026 at 1:01 am

    According to the documentation I found (here: http://msdn.microsoft.com/en-us/library/office/ff822605.aspx, and here: http://msdn.microsoft.com/en-us/library/office/aa612949(v=office.10).aspx), the Borders property returns a collection, indexed by constant that represents which border you want (top, bottom, left, right, etc.)

    Your line should maybe look like this,

    sheet.Cells(1, i).Borders(xlEdgeBottom).LineStyle = Excel.XlLineStyle.xlContinuous
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently turned a couple of my plugins into submodules and realized that when
I recently encountered a printing issue in Firefox that eventually turned out to be
Recently I bumped into a problem where my OpenGL program would not render textures
Recently we turned a set of complicate C# based scheduling logic into SQL CLR
I recently turned an old Joomla site into a Wordpress site and I want
Recently I turned my gmail account into 2-step verification ON.Now when I try to
I recently discovered Mustache, and after reading through all the documentation online, I am
I recently spent a long while debugging something that turned out to be an
Possible Duplicate: PHP: “Notice: Undefined variable” and “Notice: Undefined index” Recently turned on errors
I run an nginx-powered application and I recently turned my attention to using it

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.