PDA

View Full Version : Excel VBA



patilbush
04-17-2018, 01:25 PM
I want to save any extension file into Access DB using Excel VBA file Dialog Box. Do anyone know how to do it Thank You.

patilbush
04-17-2018, 01:43 PM
Here is the code but this saves file on my computer I want it should save in Access directly. Thank you
Dim cnn As ADODB.Connection
Set cnn = New ADODB.Connection
Dim fd As FileDialog
Dim var As Boolean
Set cnn = New ADODB.Connection
cnn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & ThisWorkbook.Path & "\File.accdb;Persist Security Info=False;"
Set fd = Application.FileDialog(msoFileDialogSaveAs)
fd.Show
If Not var Then
MsgBox "Enter name to save file"
End If
fd.Execute