|
平台的导出按钮代码
Private Sub cmdExport_Click()
On Error GoTo Err_Handler
Dim strSQL As String
Dim strExcelName As String
strSQL = Me.sfmSubForm.Form.RecordSource
'【导出语句】
If InStr(1, strSQL, "Select") = 0 Then strSQL = "select * from " & strSQL & ";"
If Me.sfmSubForm.Form.FilterOn = True Then
strSQL = Replace(strSQL, ";", "") '去掉;号
strSQL = "select * from (" & strSQL & ") as qryA where " & Me.sfmSubForm.Form.Filter
End If
'【导出结果】
strExcelName = Me.Caption & Format(Date, "_yyyymmdd")
gf_ExportToExcelBySql strSQL, strExcelName
Exit Sub
Err_Handler:
gf_MsgBox "", errError:=Err
End Sub
怎么能让导出到EXCEL后,单元格自动调整宽度?
|
|