Private Sub cmd_expExcel_Click() Dim xlapp As Excel.Application On Error GoTo cmd_expExcel_Click_Err Me.frm_qcls_ttr.SetFocus DoCmd.RunCommand acCmdSelectAllRecords DoCmd.RunCommand acCmdCopy Set xlapp = CreateObject("Excel.Application") With xlapp .Workbooks.Add .ActiveSheet.PasteSpecial Format:="Text", Link:=False, DisplayAsIcon:=False .Cells.Select .Cells.EntireColumn.AutoFit .Visible = True .Range("A1:L1").Select .Selection.Font.Bold = True .Range("A1").Select End With 'Can't get border added on used range. This range will change depending on how many columns are selected on the form and how records exist. 'Need help with this part; this works as an Excel Macro, but doesn't work from Access. [embed=file 1153580][embed=file 1153581] 'Throwing Error message with the Border Code below "Object doesn't Support this Object or Method" 'With xlapp ' .ActiveSheet.UsedRange.Borders ' .LineStyle = xlContinuous ' .Weight = xlHairline ' .ColorIndex = xlAutomatic 'End With DoCmd.GoToControl "cmd_expExcel" 'Also need help with clearing the clipboard Set xlapp = Nothing cmd_expExcel_click_Exit: Exit Sub cmd_expExcel_Click_Err: MsgBox Error$ Resume cmd_expExcel_click_Exit End Sub
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.