Export from Access using vba

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am exporting data from Access to excel using a vba routine in access. I
also need to create a macro in in the Excel sheet. The VBA creates a copy of
a template I have created. The data is loaded in the new copy of the
template. I recorded a macro to subtotal columns in the template.

The problem is after I load the data the Macro is no longer in the spread
sheet. How can I load the data then run a macro in the sheet to subtotal the
columns?
 
You should make your Macro an addin:

Here is an example of addin

public class ThisAddIn

Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Startup
' Start of VSTO generated code

Me.Application =
CType(Microsoft.Office.Tools.Excel.ExcelLocale1033Proxy.Wrap(GetType(Excel.Application), Me.Application), Excel.Application)

' End of VSTO generated code

MessageBox.Show("Hello World")


End Sub

Private Sub ThisAddIn_Shutdown(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Shutdown

End Sub

End class


Please rate this posting if it was helpful it helps us provide better advise.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top