J
jd316632
I've already got in MS Access 07 a macro to export my data into an excel
doc across multiple sheets and the name to update since it is ran daily.
Now what I would like to do is have Access just tell Excel to run the
macro that handles the formatting across all the sheets.
I've searched the forums all I'm able to find is:
Dim xls As Object, xwkb As Object
Dim strFile As String, strMacro As String
strFile = "ExcelFilename.xls"
strMacro = "MacroName"
Set xls= CreateObject("Excel.Application")
xls.Visible = True
Set xwkb = xls.Workbooks.Open("C:\" & strFile)
xls.Run strFile & "!" & strMacro
xwkb.Close False
Set xwkb = Nothing
xls.Quit
Set xls = Nothing
Updated with my information it looks like:
Dim xlsx As Object, xwkb As Object
Dim strFile As String, strMacro As String
strFile = "All Open Tickets All Queues - " &
Format(Date(),"mm-dd-yyyy") & ".xlsx"
strMacro = "PERSONAL.XLSB!All_Open_Tickets_Formatting"
Set xlsx= CreateObject("Excel.Application")
xlsx.Visible = True
Set xwkb = xls.Workbooks.Open("C:\Documents and
Settings\JHenson\Desktop\All Open Tickets All Queues - " &
Format(Date(),"mm-dd-yyyy") & ".xlsx" & strFile)
xlsx.Run strFile & "!" & strMacro
xwkb.Close False
Set xwkb = Nothing
xlsx.Quit
Set xlsx = Nothing
but I get a compile error for invalid outside procedure for
strFile = "All Open Tickets All Queues - " &
Format(Date, "mm-dd-yyyy") & ".xlsx"
If I knew more about VBA I might be able to figure why however in
looking for various forums I'm not able to find a code that will do the
trick.
Any help is greatly appreciated.
doc across multiple sheets and the name to update since it is ran daily.
Now what I would like to do is have Access just tell Excel to run the
macro that handles the formatting across all the sheets.
I've searched the forums all I'm able to find is:
Dim xls As Object, xwkb As Object
Dim strFile As String, strMacro As String
strFile = "ExcelFilename.xls"
strMacro = "MacroName"
Set xls= CreateObject("Excel.Application")
xls.Visible = True
Set xwkb = xls.Workbooks.Open("C:\" & strFile)
xls.Run strFile & "!" & strMacro
xwkb.Close False
Set xwkb = Nothing
xls.Quit
Set xls = Nothing
Updated with my information it looks like:
Dim xlsx As Object, xwkb As Object
Dim strFile As String, strMacro As String
strFile = "All Open Tickets All Queues - " &
Format(Date(),"mm-dd-yyyy") & ".xlsx"
strMacro = "PERSONAL.XLSB!All_Open_Tickets_Formatting"
Set xlsx= CreateObject("Excel.Application")
xlsx.Visible = True
Set xwkb = xls.Workbooks.Open("C:\Documents and
Settings\JHenson\Desktop\All Open Tickets All Queues - " &
Format(Date(),"mm-dd-yyyy") & ".xlsx" & strFile)
xlsx.Run strFile & "!" & strMacro
xwkb.Close False
Set xwkb = Nothing
xlsx.Quit
Set xlsx = Nothing
but I get a compile error for invalid outside procedure for
strFile = "All Open Tickets All Queues - " &
Format(Date, "mm-dd-yyyy") & ".xlsx"
If I knew more about VBA I might be able to figure why however in
looking for various forums I'm not able to find a code that will do the
trick.
Any help is greatly appreciated.