|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 baowang519 于 2011-10-1 15:06 编辑
各位前辈:我想把公式保存进access,这样在重新调回excel是就可以重新计算,不知道sql可不可以实现,如果能实现的话应该怎么写代码?请前辈们帮忙解决一下,谢谢!祝前辈们节日快乐!
附件图片中红色部分为公式实现。
目前“成长记录”的代码为:
Private Sub 成长记录_Click()
Application.ScreenUpdating = False
Application.EnableEvents = False
Dim conn As Object
Dim sql$
sql = "insert into [成长预定] select * from [excel 12.0;database=" & ThisWorkbook.FullName & "].[sheet14$C31:L32]; "
Set conn = CreateObject("adodb.connection")
With conn
.Provider = "microsoft.ACE.oledb.12.0"
.ConnectionString = "Data Source =" & ThisWorkbook.Path & "\shuju.accdb"
.Open
End With
conn.Execute (sql)
conn.Close
Set conn = Nothing
Range("C32:L32").ClearContents
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
|
|