CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2007
    Location
    Argentina
    Posts
    579

    [RESOLVED] Fast write to excel, no more working.

    In VB6, this code worked fine, and was the fastest way to write to excel:
    Code:
    Dim MyExcelRange As Excel.Range
    	'Code here filling MyExcelRange with data
    
    	'Now, fast copying into excel:
    	With MyExcelRange
    		MyExcelWorksheet.Range("A1").Resize(.Rows.Count, .Columns.Count) = MyExcelRange
    	End With 'MyExcelRange
    But now, in VB.NET .Resize() is a read only property, so it no more works.

    Is critical to write the data fast, so what is the new fast way to transfer data to excel??
    .

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: Fast write to excel, no more working.


  3. #3
    Join Date
    Mar 2007
    Location
    Argentina
    Posts
    579

    Re: Fast write to excel, no more working.

    Quote Originally Posted by HanneSThEGreaT
    It is. You did it again. Thanks you.

    For short, the new right line of code is:
    Code:
     MyExcelWorksheet.Range("A1").Resize(.Rows.Count, .Columns.Count).Value = MyExcelRange
    By the way... ¿how did you find it? I had searched it for hours...
    _

  4. #4
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: Fast write to excel, no more working.

    I'm glad that you got it solved!

    I don't know, perhaps luck LOL! No, seriouisly, I've got a huge list of resource websites on my PC, which I've compiled over the years, so that made it a little bit easier

    Have fun!

  5. #5
    Join Date
    Dec 2002
    Posts
    305

    Re: [RESOLVED] Fast write to excel, no more working.

    Marraco:

    How do you assign data to MyExcelRange. Do the data have to come from Excel or can it be dataset or a 2-D array? Thanks.

  6. #6
    Join Date
    Dec 2002
    Posts
    305

    Re: [RESOLVED] Fast write to excel, no more working.

    Please don't reply. HanneSThEGreaT's url provides the info. Thanks, both.

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

Featured