Writing Data in Excel format

Posted on 1999-07-22
Medium Priority
Last Modified: 2010-04-30
Hi, I have some data that I'd like to write in an Excel spreadsheet directly from my VB program.

Can somebody give me some sample code to add the text in a cell for example?

Question by:mikemonnex
1 Comment

Accepted Solution

mayhew earned 400 total points
ID: 1526671
Dim app As Excel.Application
'Create instance of Excel object.
Set app = New Excel.Application
'Make app visible so you can see what happens.
app.Application.Visible = True

'Open an existing workbook.
app.Workbooks.Open app.Path & "\" & "MyWorkbook.xls"

'Select a sheet.

'Select a cell.

'Enter some data.
app.Application.ActiveCell.Value = "Whatever you want."

'Save the workbook.

'Or save as a different workbook.

'Close the workbook.

'Close the app.
Set app = Nothing


Featured Post

7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

600 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