Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 155
  • Last Modified:

Record an excel macro within vb app

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
damion69
Asked:
damion69
1 Solution
 
leojlCommented:
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
 
leojlCommented:
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
 
Richie_SimonettiCommented:
Basically, what leojl saids is true, do you need in other way?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
leojlCommented:
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
 
n_narayananCommented:
0
 
damion69Author Commented:
Thank you for this. Sorry it took so long, I am no longer on the project that needed that.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now