技術(shù) 點
- 技術(shù)
- 點
- V幣
- 點
- 積分
- 661

|
平臺的導(dǎo)出按鈕代碼
Private Sub cmdExport_Click()
On Error GoTo Err_Handler
Dim strSQL As String
Dim strExcelName As String
strSQL = Me.sfmSubForm.Form.RecordSource
'【導(dǎo)出語句】
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
'【導(dǎo)出結(jié)果】
strExcelName = Me.Caption & Format(Date, "_yyyymmdd")
gf_ExportToExcelBySql strSQL, strExcelName
Exit Sub
Err_Handler:
gf_MsgBox "", errError:=Err
End Sub
怎么能讓導(dǎo)出到EXCEL后,單元格自動調(diào)整寬度?
|
|