I've written code to export data from Access into an Excel spreadsheet. I have everything working except one part. Within 1 of the worksheets, I've created a chart. Using VBA, I've added a text box to the chart. I can't figure out how to place a formula within the text box. Here's the code I have:
Any suggestions??
Dim xlApp As Object
Dim wbExcel As Object
Dim sheetExcel As Worksheet
Dim shapeExcel As Shape
Set xlApp = New Excel.Application
'xlApp.Visible = True
Set wb1 = xlApp.Workbooks.Open(Environ$("USERPROFILE") & "\documents\" & strFileName & ".xlsx")
Set sheetExcel = wb1.Sheets(1)
Set shapeExcel = sheetExcel.Shapes.AddTextBox(msoTextOrientationHorizontal, 171, 135, 25, 25)
'Selection.Formula = "='Auto Submit Calculations'!B3"
'sheetExcel.Shapes("TextBox 1").Formula = "='Auto Submit Calculations'!B3"
'shapeExcel.Select
'Close and Save Workbook
xlApp.ActiveWorkbook.Close (True)
'Close Excel Object
xlApp.Quit
Set shapeExcel = Nothing
Set sheetExcel = Nothing
Set wb1 = Nothing
Set xlApp = Nothing
Any suggestions??