❶ 如何用VBA实现操作网页上传文件
VBA访问FTP进行文件传输的,网络上见到3种方式,用过2种。
一、VBA+DOS批处理的方式,本质上还是通过DOS来进行,有点麻烦,而且运行中会弹出CMD窗口,现在已经不用这种方法了。
VBA写DOS:
Open getfd For Output As #1 Print #1, "setlocal EnableDelayedExpansion" Print #1, "(" Print #1, "echo;open xx.xx.xx.xx" Print #1, "echo;user" Print #1, "echo;pwd" Print #1, "echo;cd """; ftpfdx8; """" Print #1, "echo;prompt" Print #1, "echo;dir" Print #1, "echo;bye" Print #1, ") > """; fdx8; """" Print #1, Print #1, "ftp -v -i -s:"""; fdx8; """ | find ""ftpgroup"" > """; folderx8; """" Print #1,
VBA运行它:
1
Shell ("ftp -v -i -s:" & ftpfile)
二、VBA调用API,具体是basp21.dll
详见,说明很详细,有实例
示例如下,比较简单易懂,其中getfile为下载,上传使用putfile就好了。
❷ 用vba如何批量插入图片,公式详解
您好,根据您的需求,批量插入图片的参考代码如下:
OptionExplicit
PublicSub批量插入图片()
DimrngPictureAsRange
DimlngRowAsLong
DimintColAsInteger
WithActiveSheet
ForlngRow=1To16Step8
ForintCol=1To12Step3
SetrngPicture=.Cells(lngRow+1,intCol+2)
rngPicture.Select
With.Pictures.Insert("E:坑图"&rngPicture.Value&".jpg").ShapeRange
.Height=70.5
.Width=105
EndWith
Next
Next
EndWith
SetrngPicture=Nothing
EndSub
PS:具体使用时请自行修改演示代码中的循环起止行、起止列和步进值。如果图片插入到单元格后出现偏移,请设置 Picture 的 Left 属性和 Top 属性。
另外,也可以设置图片在单元格内水平居中(比单元格大的图片暂不考虑),参考代码如下:
OptionExplicit
PublicSub批量插入图片水平居中()
DimrngPictureAsRange
DimlngRowAsLong
DimintColAsInteger
WithActiveSheet
ForlngRow=1To16Step8
ForintCol=1To12Step3
SetrngPicture=.Cells(lngRow+1,intCol+2)
rngPicture.Select
With.Pictures.Insert("E:坑图"&rngPicture.Value&".jpg").ShapeRange
.Left=rngPicture.Left+(rngPicture.Width-.Width)/2
.Top=rngPicture.Top+(rngPicture.Height-.Height)/2
EndWith
Next
Next
EndWith
SetrngPicture=Nothing
EndSub
❸ excel VBA 我想要在一个单元格中做一个上传文件的按钮,单击该按钮弹出图片选择器
可以实现的。望采纳
❹ 2007版Excel怎样用VBA代码插入图片求代码
1、打开Excel,准备好表格。
❺ vba 怎么自动插入多个文件夹中的图片
1.打开Excel文件,录入数据。
❻ 怎么用VBA批量发图片
试试下面的代码:
Sub批量插入图片()
DimwjAsString
DimrngAsRange
Sheets("SHeet1").Select'选中要插入图片的工作表
x=[a65536].End(xlUp).Row'取得最后一行的行号
Fori=2Tox
na=Cells(i,2)'从第二列(即B列)得到图片名称,并以此名查找图片
wj="e:照片"&""&na&".jpg"'图片文件存储的路径与格式(.jpg)
IfDir(wj)<>""Then
Cells(i,4).Select'图片需要插入到第四列(即d列)
ActiveSheet.Pictures.Insert(wj).Select
Setrng=Cells(i,4)'根据单元格的大小调整图片
WithSelection
.Top=rng.Top+1
.Left=rng.Left+1
.Width=rng.Width-1
.Height=rng.Height-1
EndWith
EndIf
Next
MsgBox"图片插入完毕"
EndSub
❼ VBA如何实现插入图片
可以写,要根据你实际的来,比如 文件夹路径