Results 1 to 3 of 3

Thread: Converting VB.net code to VBA

  1. #1
    Junior Member
    Join Date
    May 12
    Posts
    24

    Converting VB.net code to VBA

    I have been working on vb for past few days..Its really interesting.But I wanna know how can we convert VB.net code to vba. A code which I wanna convert to VBA and run it as a macro. Please any help would be appreciative.

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 05
    Location
    Sydney, Australia
    Posts
    80,860

    Re: Converting VB.net code to VBA

    VB.NET provides far more functionality than VBA. Some code might be able to be translated as is, some might need a bit of tweaking and some might be all but impossible to replicate. It all depends on the specifics of the code.

  3. #3
    Junior Member
    Join Date
    May 12
    Posts
    24

    Re: Converting VB.net code to VBA

    Thanks..code is something like the below.
    Code:
    Dim col As Integer = DGV.Columns.Count
    If col > 1 Then
    Dim start As Date = Date.Today.Add(New TimeSpan(0, 15, 0))
    Dim end As Date = Date.Today.Add(New TimeSpan(11, 15, 0))
    Dim cellV As String, cellD As Date
    For i As Integer = 1 To col - 1
    For Each row As DataGridViewRow In DGV.Rows
    cellV = row.Cells(i).Value.ToString
    If Date.TryParse(cellV, cellD) Then
    If cellD > start AndAlso cellD < end Then
    row.Cells(i).Style.BackColor = Color.brown
    End If
    End If
    Next
    Next
    End If
    Quote Originally Posted by jmcilhinney View Post
    VB.NET provides far more functionality than VBA. Some code might be able to be translated as is, some might need a bit of tweaking and some might be all but impossible to replicate. It all depends on the specifics of the code.

Posting Permissions

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