• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 237
  • Last Modified:

VB Form operate with Excel

I want to know that how does Visual Basic form work with Excel. My idea is that I use VB from to get some staistic data from DataBase. After this, VB from will pass data to Excel to plot a graph, like bar chat...etc. Finally, the result of Excel will be shown on VB form. However, I don't know how can I do this. Please Help me with example coding. Thanks a lot
1 Solution
 try this type of code write in the Excel

  Set excel_app = CreateObject("Excel.Application")
    excel_app.Workbooks.Open FileName:="C:\emp.xls"
    If Val(excel_app.Application.Version) >= 8 Then
        Set excel_sheet = excel_app.ActiveSheet
        Set excel_sheet = excel_app
    End If
for i roww = 1 to 40

for colmn = 1 to 40
   excel_sheet.Cells(roww, colmn).Font.Color = RGB(0, 0, 0)
   excel_sheet.Cells(roww, colmn) = ""
   excel_sheet.Cells(roww, colmn).Font.Size = 8
  excel_sheet.Cells(roww, colmn).Font.FontStyle = "Regular"
     excel_sheet.Cells(6, 1) = "CODE"
     excel_sheet.Cells(6, 2) = "NAME"
     excel_app.ActiveWindow.FreezePanes = False

    txtFromVal & " AND " & txtToVal & "  FOR  " & Opt
      excel_sheet.Cells(1, 3).Font.FontStyle = "Bold"
The accepted answer links to a question that has been deleted.  :-(

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now