michiel_soede

New Member
Joined
Oct 7, 2009
Messages
15
Dear all,

Hopefully someone here to help me out. I am using below code to store an excel sheet with ADO in an access database on a server. Is is possible to do such an ADO load to an Access database to a sharepoint location?


If so what string do I need to use if the web address is like this: https://sam.michiel.nl/afdelingen/Dv...0bijlagen.aspx

Many thanks for your input,

Michiel

Code:
[/COLOR][COLOR=#333333]Sub Upload_Flattable_Program_to_Access()[/COLOR]
Dim con As Object  '' ADODB.Connection
Dim padplusnaam As String
Dim pad As String


'~~> write to new Excel book


x = ActiveWorkbook.Name
pad = ActiveWorkbook.Path
WERKMIJ = Range("WERKMIJ")


naam = "" + CStr(pad) + "" & "\history\Export_" & Day(Date) & "-" & Month(Date) & "-" & Year(Date) & Hour(Time) & Minute(Time) & Second(Time) & "-" & CStr(WERKMIJ) & "-" & CStr(Environ("Username")) & ".xlsx"


ThisWorkbook.Unprotect


Sheets("DATA").Visible = True


y = ActiveWorkbook.Name


Workbooks.Add


Z = ActiveWorkbook.Name


Workbooks(y).Worksheets("DATA").Copy After:=Workbooks(Z).Sheets(Workbooks(Z).Sheets.Count)
   
   ActiveWorkbook.SaveAs Filename:= _
        "" + CStr(naam) + "", FileFormat:=51, Password:= _
        "", WriteResPassword:="", ReadOnlyRecommended:=False, CreateBackup:= _
        False




NameNewbook = ActiveWorkbook.Name
padplusnaam = ActiveWorkbook.FullName


Application.StatusBar = "Write AccessDatabase"


If Worksheets("DATA").FilterMode = True Then
Worksheets("DATA").ShowAllData
End If


'~~~~> Export data to Access DB
Set con = CreateObject("ADODB.Connection")  '' New ADODB.Connection


con.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data source=" & pad & "\Data\Risicoprofiel.accdb;"
con.Execute _
        "INSERT INTO TBL_DATA_RISICO_PROFIEL " & _
        "SELECT * FROM [Excel 12.0 Xml;HDR=YES;IMEX=2;ACCDB=YES;DATABASE=" & padplusnaam & "].[DATA$]"
con.Close


Set con = Nothing


Application.StatusBar = False


ActiveWorkbook.Close
Windows(x).Activate


Sheets("DATA").Visible = False


'ThisWorkbook.Protect

 [COLOR=#333333]End Sub[/COLOR][COLOR=#333333]
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Forum statistics

Threads
1,214,649
Messages
6,120,733
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top