?
Solved

VB Form operate with Excel

Posted on 2003-03-05
3
Medium Priority
?
224 Views
Last Modified: 2010-04-07
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
0
Comment
Question by:ryanlam2k3
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Expert Comment

by:sudipta_pal
ID: 8079163
 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
    Else
        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"
 next
next  
     
     excel_sheet.Cells(6, 1) = "CODE"
     excel_sheet.Cells(6, 2) = "NAME"
     excel_sheet.Rows(5).Select
     excel_app.ActiveWindow.FreezePanes = False

    txtFromVal & " AND " & txtToVal & "  FOR  " & Opt
      excel_sheet.Cells(1, 3).Font.FontStyle = "Bold"
0
 

Accepted Solution

by:
Minutes earned 160 total points
ID: 8125031
0
 
LVL 7

Expert Comment

by:bouscal
ID: 12450734
The accepted answer links to a question that has been deleted.  :-(
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month13 days, 10 hours left to enroll

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question