applejackson
Programmer
I am looking for some help with formatting an excel workbook (upon activation) that has been exported from an Access 2000 form with VB on the back end.
I had originally thought that I needed to do this through a module and procedure, but I have not written many so I am not sure. I also tried to do this by loading a custom button with a macro to the workbook when it loads.
This form exports Audio CDR files from a query based on the bridge and date select by the user on the form.
Here is the code for the export
Private Sub Command6_Click()
If Me.Combo2 = "Aries" Then
DoCmd.OutputTo acOutputQuery, "A_CDR_out", acFormatXLS, "Aries.xls", True
DoCmd.Close acForm, "CDRs", acSaveNo
DoCmd.OpenForm "CDR Navigator", acNormal, , , acFormPropertySettings, acWindowNormal
ElseIf Me.Combo2 = "Gemini" Then
DoCmd.OutputTo acOutputQuery, "g_CDR_out", acFormatXLS, "Gemini.xls", True
DoCmd.Close acForm, "CDRs", acSaveNo
DoCmd.OpenForm "CDR Navigator", acNormal, , , acFormPropertySettings, acWindowNormal
ElseIf Me.Combo2 = "Orion" Then
DoCmd.OutputTo acOutputQuery, "g_CDR_out", acFormatXLS, "Orion.xls", True
DoCmd.Close acForm, "CDRs", acSaveNo
DoCmd.OpenForm "CDR Navigator", acNormal, , , acFormPropertySettings, acWindowNormal
ElseIf Me.Combo2 = "Zeus" Then
DoCmd.OutputTo acOutputQuery, "g_CDR_out", acFormatXLS, "Zeus.xls", True
DoCmd.Close acForm, "CDRs", acSaveNo
DoCmd.OpenForm "CDR Navigator", acNormal, , , acFormPropertySettings, acWindowNormal
Else
End If
End Sub
The code for the module or macro looks something like:
Sub Output()
Columns("B:C".Select
Selection.NumberFormat = "h:mm:ss AM/PM"
Columns("F:F".EntireColumn.AutoFit
Columns("F:F".Select
Selection.NumberFormat = "0"
Columns("G:G".EntireColumn.AutoFit
End Sub
Any help would be great
I had originally thought that I needed to do this through a module and procedure, but I have not written many so I am not sure. I also tried to do this by loading a custom button with a macro to the workbook when it loads.
This form exports Audio CDR files from a query based on the bridge and date select by the user on the form.
Here is the code for the export
Private Sub Command6_Click()
If Me.Combo2 = "Aries" Then
DoCmd.OutputTo acOutputQuery, "A_CDR_out", acFormatXLS, "Aries.xls", True
DoCmd.Close acForm, "CDRs", acSaveNo
DoCmd.OpenForm "CDR Navigator", acNormal, , , acFormPropertySettings, acWindowNormal
ElseIf Me.Combo2 = "Gemini" Then
DoCmd.OutputTo acOutputQuery, "g_CDR_out", acFormatXLS, "Gemini.xls", True
DoCmd.Close acForm, "CDRs", acSaveNo
DoCmd.OpenForm "CDR Navigator", acNormal, , , acFormPropertySettings, acWindowNormal
ElseIf Me.Combo2 = "Orion" Then
DoCmd.OutputTo acOutputQuery, "g_CDR_out", acFormatXLS, "Orion.xls", True
DoCmd.Close acForm, "CDRs", acSaveNo
DoCmd.OpenForm "CDR Navigator", acNormal, , , acFormPropertySettings, acWindowNormal
ElseIf Me.Combo2 = "Zeus" Then
DoCmd.OutputTo acOutputQuery, "g_CDR_out", acFormatXLS, "Zeus.xls", True
DoCmd.Close acForm, "CDRs", acSaveNo
DoCmd.OpenForm "CDR Navigator", acNormal, , , acFormPropertySettings, acWindowNormal
Else
End If
End Sub
The code for the module or macro looks something like:
Sub Output()
Columns("B:C".Select
Selection.NumberFormat = "h:mm:ss AM/PM"
Columns("F:F".EntireColumn.AutoFit
Columns("F:F".Select
Selection.NumberFormat = "0"
Columns("G:G".EntireColumn.AutoFit
End Sub
Any help would be great