Link to home
Create AccountLog in
Avatar of K Feening
K FeeningFlag for Australia

asked on

Vb.net Excel Spread Sheet

Hi I am using Vb.net and I need to create an Excel Spreadsheet dynamically with Columns for name and 4 for data validation im using the folllowing
Imports System.Data.SqlClient
Imports System.Data.Sql
Imports System.Xml

Imports System.Data
Imports System.Configuration

Imports System.Windows.Forms
Imports Microsoft.Office.Interop
Imports Microsoft.Office.Interop.Excel
Imports System.Runtime.InteropServices
Imports Microsoft.Office

Imports System.IO
Imports System.Text   
Private Sub bExport_Click(sender As System.Object, e As System.EventArgs) Handles bExport.Click
Dim xlApps As Excel.Application
        Dim xlWorkBooks As Excel.Workbook
        Dim xlWorkSheets As Excel.Worksheet
        Dim misValues As Object = System.Reflection.Missing.Value
        xlApps = New Excel.ApplicationClass
        xlWorkBooks = xlApps.Workbooks.Add(misValues)
        xlWorkSheets = xlWorkBooks.Sheets("sheet1")
 Dim FiletoOpen As String = "FredFlinstone.xlsx"
 xlWorkSheets.SaveAs(FiletoOpen)
        xlWorkBooks.Close()
        xlApps.Quit()

End Sub

Open in new window


How do I create the required Excel sheel

User generated image
Avatar of Andrei Fomitchev
Andrei Fomitchev
Flag of United States of America image

Dim xlWorkseet1 As Excel.Worksheet = xlWorkbooks.WorkSheets.Add()
xlWorkseet1.Name = "newName"

Avatar of K Feening

ASKER

Thanks Andrei didn't explain my self correctly need to find how to create the data validation drop downs in vb.net
found article explaining thanks again

https://stackoverflow.com/questions/44954793/vb-net-inserting-data-validation-in-excel-cell
ASKER CERTIFIED SOLUTION
Avatar of K Feening
K Feening
Flag of Australia image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer