Solved

Record an excel macro within vb app

Posted on 2002-05-06
6
145 Views
Last Modified: 2010-05-02
Is there a way to open an excel document into my app, and record a macro and save the macro like in office? I can increase the points if needed
0
Comment
Question by:damion69
6 Comments
 
LVL 3

Accepted Solution

by:
leojl earned 100 total points
Comment Utility
hi,

I have a form in VB6 that I use to work with Excel
' this is in the general section of the form
Dim Eapp As Excel.Application
Dim Ebook As Excel.Workbook
Dim Esheet As Excel.Worksheet

'This starts Excel and shows sheet1
'sheet1 is the active sheet.
'now you can work directly with Excel and record a macro.

Private Sub mnuExcel_Click()
Set Eapp = New Excel.Application
Set Ebook = Eapp.Workbooks.Add
Eapp.Visible = True
End Sub

'I you do not wish to save Excel click here
Private Sub mnuNothing_Click()
Eapp.Quit
Set Eapp = Nothing
End Sub

leo
0
 
LVL 3

Expert Comment

by:leojl
Comment Utility
hi again,

In VB design mode you should click on the
Project Menu, then click Referances
then scroll to Microsoft Excel 9.0 Object Library
check the box and click OK.

I have Office 2000 which has 9.0..
You might have a different number.

leo
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
Comment Utility
Basically, what leojl saids is true, do you need in other way?
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 3

Expert Comment

by:leojl
Comment Utility
hi yet again,

Richie, I would appreciate seeing another approach.
Perhaps more sophisticated to first check if there is
a running Excel and also to deal with possible errors.

leo
0
 
LVL 3

Expert Comment

by:n_narayanan
Comment Utility
0
 
LVL 2

Author Comment

by:damion69
Comment Utility
Thank you for this. Sorry it took so long, I am no longer on the project that needed that.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

743 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now