Results 1 to 4 of 4

Thread: Help with VB

  1. #1

    Default Help with VB


    Kinsa'y kahibaw muhimo ug program sa VB nga ang iyang output kay muderecho sa excel? need help!

  2. #2
    Naa koy program na makabuhat ani. Unya nibuhat sad ko ug tut about ani. Makita ni nimo sa ako blog, d lang nako ipost ang link.


    You have to have a reference of ms excel on vb6. Do this by:
    1. Open Visual Basic 6.0.
    2. Add a new project. ( FILE > NEW)
    3. Select STANDARD EXE > click OK.
    4. Add a reference, Go to PROJECT > REFERENCE.
    5. On the Pop-up window, Scroll down and look for MICROSOFT EXCEL 11.0 Object Library. In my case, I'm using Excel 2003 that is why it is 11.0, could be another version depending on what you have on your computer.

    That's it! you now have a reference to excel. Below are the codes you can use:


    Dim objExcel As New Excel.Application
    Set objExcel = New Excel.Application

    First you have to declare a variable(above) to ensure that you can use the codes below:

    Sheet Settings:
    objExcel.Workbooks.Add
    objExcel.Cells.Select
    With objExcel.Selection.Font
    .Name = "Arial"
    .FontStyle = "Regular"
    .Size = 8
    .Strikethrough = False
    .Underline = xlUnderlineStyleNone
    .ColorIndex = xlAutomatic
    End With

    To add text on a cell:
    objExcel.Cells(Row, Col) = "Your Text Here"

    Merge Cells
    objExcel.Range().MergeCells = True
    'Ex:.Range("B2:G2").MergeCells = True

    Center Cell Data
    objExcel.Range().HorizontalAlignment = Excel.Constants.xlCenter
    'Ex: objExcel.Range("B2:G2").HorizontalAlignment = Excel.Constants.xlCenter

    Column Width
    objExcel.Range("A1:A1").ColumnWidth = 5


    Cell Backcolor

    objExcel.Cells(Row,Coli).Interior.ColorIndex = 15


    Adding Borders to a cell

    Public Sub CellBorder(Row As Integer, Col As Integer, Side As XlBordersIndex, Style As XlLineStyle, Weight As XlBorderWeight, Color As Long)
    With objExcel.Cells(Row, Col).Borders(Side)
    .LineStyle = Style
    .Weight = Weight
    .ColorIndex = Color
    End With
    End Sub

    To Password protect Excel file:
    objExcel.Worksheets("Sheet1").Protect Password:=

    To display Excel
    objExcel.Visible = True

  3. #3
    @CometBurn

    Thanks sir, but actually this is what I was planning to make for our project:

    The program has 3 Empty text boxes(Box 1 for the Name, Box 2 for the course and Box 3 for the Year level) which is to be filled out and one command button with "register" as the caption.

    What I planned for the program is that it'll print out the name, course and year level on excel(the excel has 3 columns: name, course and year) after pressing the register button.

  4. #4
    unsa nga version sa vb?

  5.    Advertisement

Similar Threads

 
  1. Who needs help with their vb/c# projects?
    By Cruzader in forum Programming
    Replies: 19
    Last Post: 02-24-2009, 02:44 PM
  2. help with vb
    By ingkiang in forum Programming
    Replies: 3
    Last Post: 08-30-2008, 05:20 PM
  3. Help with events in VB.NET
    By DeathFox in forum Programming
    Replies: 5
    Last Post: 12-17-2007, 08:07 PM
  4. need help with p900
    By kloos in forum Gizmos & Gadgets (Old)
    Replies: 8
    Last Post: 09-04-2006, 01:55 PM
  5. help with mah 6600
    By grlnxtdor16 in forum Gizmos & Gadgets (Old)
    Replies: 8
    Last Post: 05-04-2005, 06:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top