天天看點

第一次利用chatgpt寫Excel的VBA宏程式,等下去驗證一下好不不好使。需求:幫寫一個Excel中VBA宏程式,實

作者:問題解決師

第一次利用chatgpt寫Excel的VBA宏程式, 等下去驗證一下好不不好使。

需求:

幫寫一個Excel中VBA宏程式,實作指定TXT檔案中URL位址行對應的網頁附件檔案下載下傳,後面補充條件再優化了一下,其他語言應該也可以,隻是現在Excel處理友善。

chatgpt回答:

Sub DownloadAttachment()

'定義變量

Dim myURL As String

Dim strFileName As String

Dim strPath As String

Dim strFilePath As String

Dim x As Integer

'設定檔案儲存路徑

strPath = "C:\Users\Administrator\Desktop\Attachment\"

'讀取TXT檔案中的URL位址

Open "C:\Users\Administrator\Desktop\URL.txt" For Input As #1

x = 1

Do While Not EOF(1)

Line Input #1, myURL

strFileName = "Attachment" & x & ".xls"

strFilePath = strPath & strFileName

'下載下傳檔案

URLDownloadToFile 0, myURL, strFilePath, 0, 0

x = x + 1

Loop

Close #1

end sub

第一次利用chatgpt寫Excel的VBA宏程式,等下去驗證一下好不不好使。需求:幫寫一個Excel中VBA宏程式,實
第一次利用chatgpt寫Excel的VBA宏程式,等下去驗證一下好不不好使。需求:幫寫一個Excel中VBA宏程式,實
第一次利用chatgpt寫Excel的VBA宏程式,等下去驗證一下好不不好使。需求:幫寫一個Excel中VBA宏程式,實
第一次利用chatgpt寫Excel的VBA宏程式,等下去驗證一下好不不好使。需求:幫寫一個Excel中VBA宏程式,實
第一次利用chatgpt寫Excel的VBA宏程式,等下去驗證一下好不不好使。需求:幫寫一個Excel中VBA宏程式,實

繼續閱讀