opening file in excel and running macro

A

anonymous

I am a newbie and saw recently where someone provided info
about running a macro in excel from access. I would like
to take this a step further. Everyday I am creating 2
excel 2.1 files (from Monarch). I need to import this
into access however I can't without saving the files in a
higher version of excel. Is it possible to open the files
and save them as a higher version and then import them
from access. I have attempted to modify the code which I
saw as follows
thank in advance

Dim oApp As Object, xwkb As Object, xwkb1 As Object,
xwkb2 As Object
Dim strFile As String, strMacro As String
strFile = "PERSONAL.xls"
strMacro = "SaveAndClose"

Set oApp = CreateObject("Excel.Application")

Set xwkb1 = oApp.Workbooks.Open("C:\TestD")

Set xwkb = oApp.Workbooks.Open("C:\Program
Files\Microsoft Office\Office\XLStart\" & strFile)

oApp.Run strFile & "!" & strMacro
xwkb1.Close False
Set xwkb1 = Nothing

Set xwkb2 = oApp.Workbooks.Open("C:\TestC")
oApp.Run strFile & "!" & strMacro
xwkb2.Close False
Set xwkb2 = Nothing

xwkb.Close False
Set xwkb = Nothing

oApp.Quit
Set oApp = Nothing
oApp.Visible = True
 

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

Top