[英]How to insert an image in an imagebox through path on a server
嗨,我正在使用這樣的代碼將圖像加載到圖像框中:
Dim ws As Worksheet, fname As String
Dim p As Object
'~~> Adding a temp sheet
Set ws = ThisWorkbook.Sheets.Add
'~~> Insert the picture in the newly created worksheet
fname = "\\IPADDRESS\folder\fototest\image.jpg"
SavePicture img.Picture, fname
DoEvents
Set p = ws.Pictures.Insert(fname)
問題是圖像位於我通過IP地址訪問的服務器上,由於無法訪問該地址,excel崩潰了。 我該如何解決?
由於缺乏對目標目錄的權限,您的VBA崩潰了。 為了使用SavePicture
過程,首先,您需要在遠程目標目錄中具有read write execute
權限,並確保如果該服務器位於其他域中,則可以訪問該服務器。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.