By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,640 Members | 2,279 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,640 IT Pros & Developers. It's quick & easy.

opening a new excel sheet using VB

P: 1
HII ...
please give me a code to open a new excel sheet using VB so that i can also directly add some contents in the cells of the excel sheet in VB itself ..
i ve use the existing excel sheet code given in this portal.. but its not working out..
so its giving error called at the
Sub Main()
Dim oExcel As Excel.Application
Dim oWB As Excel.Workbook
Dim oWS As Excel.Worksheet

Set oExcel = New Excel.Application 'its giving a error here... like User defined type not defined
oExcel.Visible = True

so please help me as soon as possible.


Apr 28 '07 #1
Share this Question
Share on Google+
1 Reply

P: 2

The code below maybe help you . In this case you can open Excel Application and write the content you want :

Expand|Select|Wrap|Line Numbers
  2.     Dim xlWb As Excel.Workbook
  3.     Dim xlWSh As Excel.Worksheet
  5.     Set xlWb = Application.Workbooks.Open(txtPath.text)
  6.     Set xlWSh = xlWb.Worksheets(ActiveSheet.Name)
Good Luck,
Apr 30 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.