天天看点

第一次利用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宏程序,实

继续阅读