Microsoft
Software
Hardware
Network
Question : VB button on Output to Excel
Hi,
I have code which outputs to excel from Access and pre-formats the spreadsheet. i am looking to incorporate an some VB buttons into the outputted spreadsheet.
So i would like the the buttons to give the user options to sort highest number to lowest number by on certain columns
So for example, column b.
Is there code i can incorporate into the Access Output button that would create these buttons on the outputted spreadsheet.
Thanks,
Seamus
Here is my current code:
Private Sub Command5_Click()
Dim strFile As String
strFile = "F:\MissingDataOutput.xls"
'DoCmd.OutputTo acOutputForm, Me.Missing Data Plug, acFormatXLS, strFile, False
DoCmd.OutputTo acOutputTable, "Missing Data Plug", acFormatXLS, strFile, False
Dim oXL As Object
Dim oWB As Object
Dim oWS As Object
Dim FormulaRow As Long
Set oXL = CreateObject("Excel.Applic
ation")
Set oWB = oXL.Workbooks.Open(strFile
)
Set oWS = oWB.Sheets(1)
With oWS
FormulaRow = .Cells(.Rows.Count, "b").End(-4162).Row + 2 'xlUp
.Cells.Font.Size = 10
.Rows(1).Font.Bold = True
.UsedRange.EntireColumn.Au
toFit
.range("b:h").NumberFormat
= "0.00%;[Red]0.00%"
.range("b:h").NumberFormat
= "#,##0.00;[Red]#,##0.00"
.range("c:e").Style = "Percent"
.range("b:b").NumberFormat
= "£#,##0.00;[Red]£#,##0.00"
.range("f:h").NumberFormat
= "£#,##0.00;[Red]£#,##0.00"
End With
oXL.Visible = True
Set oWS = Nothing
Set oWB = Nothing
Set oXL = Nothing
End Sub
Answer : VB button on Output to Excel
As far as the code for the buttons is concerned, often you can get a start by recording a macro to do the task in question, then editing it as needed.
Random Solutions
Is it possible to hide a map network drive?
PHP Loading Bar
HP-UNIX - compressing/zipping files that are 31GB
Linked Servers to "Thunk" 64-bit to 32-bit OLEDB
Copy Folder / Files From Corrupt Disk In Linux (Kubuntu)
Find Label in Datalist within Gridview
Exchange 2010 & GroupWIse 7
Documents Folder redirection on server 2008 R2 remote desktop services in SBS 2003 domain
MSExchange ActiveSync Event ID 1040 Annoying?!
How to access a folder on an SERVER when the domain server is offline ?