无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊

局域網(wǎng)內(nèi)vba程序更新的代碼-----路徑自己改

2023-03-23 21:07 作者:積硅步志千里  | 我要投稿

Private Declare PtrSafe Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

Private Declare PtrSafe Function DoFileDownload Lib "shdocvw.dll" (ByVal lpszFile As String) As Long

Private Declare PtrSafe Function DeleteUrlCacheEntry Lib "wininet" Alias "DeleteUrlCacheEntryA" (ByVal lpszUrlName As String) As Long

Sub AutoUpdate()

? ? Sheets("total").[a1].Select

? ? Dim con As New ADODB.Connection

? ? con.Open "provider=microsoft.ace.oledb.12.0;data source =C:\Users\Administrator\Desktop\net\版本號(hào).accdb"

? ? Dim sql$

? ? sql = "select 版本號(hào) from 版本號(hào)"

? ? Dim rs As New ADODB.Recordset

? ? Set rs = con.Execute(sql)

? ? Sheets("total").Range("an3").CopyFromRecordset rs

? ? rs.Close: Set rs = Nothing

? ? con.Close: Set con = Nothing

? ? If Sheets("total").[an2] <> Sheets("total").[an3] Then

? ? ? ? Sheets("total").[an3].Copy Sheets("total").[an2]

? ? ? ? MsgBox "發(fā)現(xiàn)新版本,點(diǎn)確定開始更新"

? ? ? ? On Error Resume Next

? ? ? ? Dim url As String, save_path As String, isdown As Long, fso As Object

? ? ? ? Set fso = CreateObject("Scripting.FileSystemObject")

? ?

? ? ? ? If fso.FileExists(舊版文件路徑) = True Then

? ? ? ? ? ? fso.DeleteFile 舊版文件路徑, True

? ? ? ? End If


? ? ? ? Dim folderPath As String

? ? ? ? folderPath = "C:\Users\Administrator\Desktop\Tempsave_path"

? ? ? ? If Len(Dir(folderPath, vbDirectory)) = 0 Then MkDir folderPath

? ? ? ??

? ? ? ? url = 局域網(wǎng)內(nèi)文件路徑

? ? ? ? Tempsave_path = "C:\Users\Administrator\Desktop\Tempsave_path" & "\" & fso.GetFileName(url)

? ? ? ? isdown = URLDownloadToFile(0, url, Tempsave_path, 0, 0)

? ? ? ? DeleteUrlCacheEntry (url)

? ? ? ??

? ? ? ? If Workbooks.Count = 1 Then

? ? ? ? ? ? Application.Quit

? ? ? ? End If

? ? ? ? MsgBox "更新完成!,新版在\C:\Users\Administrator\Desktop\Tempsave_path文件夾中,請(qǐng)剪切至桌面在使用!"

? ? ? ? With ThisWorkbook

? ? ? ? ? ? .Saved = True

? ? ? ? ? ? .ChangeFileAccess xlReadOnly

? ? ? ? ? ? Kill .FullName

? ? ? ? ? ? .Close

? ? ? ? End With

? ? ? ? ThisWorkbook.Close

? ? ? ? Exit Sub

? ? Else

? ? ? ? Sheets("total").[a1].Select

? ? End If

End Sub


局域網(wǎng)內(nèi)vba程序更新的代碼-----路徑自己改的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國家法律
新野县| 西和县| 兴宁市| 棋牌| 淮滨县| 柳河县| 盐池县| 商水县| 三河市| 灌南县| 棋牌| 舞钢市| 洮南市| 盐池县| 正蓝旗| 常德市| 新郑市| 报价| 大关县| 乐平市| 玉溪市| 平度市| 伊川县| 军事| 罗甸县| 湄潭县| 梧州市| 连江县| 威宁| 墨竹工卡县| 梓潼县| 利川市| 吉林省| 阿瓦提县| 山阳县| 商城县| 龙陵县| 高尔夫| 高淳县| 百色市| 星座|