Upload ảnh lên Sharepoint bằng VBA (1 người xem)

Liên hệ QC

Người dùng đang xem chủ đề này

Tôi tuân thủ nội quy khi đăng bài

nguyenhuong91

Thành viên mới
Tham gia
19/10/11
Bài viết
7
Được thích
0
Thân chào cả nhà GPEX,

Nhờ cả nhà hỗ trợ tìm lỗi giúp em code này với ạ.

Em đang dùng userform cho file được lưu sẵn ở Sharepoint với mong muốn:
1. upload ảnh từ Laptop
2. Khi submit form thì sẽ tự động upload ảnh lên folder cố định ở Sharepoint lưu file excel
3. add link ảnh vào file excel được trỏ tới.

Tuy nhiên, kết quả ra đúng nhưng khi mở ảnh từ link ở file excel thì bị lỗi. Nhờ cả nhà chỉ em với ạ!
Em cám ơn cả nhà rất nhiều ạ!

Private Sub Img_process_Submit_Click()
Dim dong_cuoi As Long
dong_cuoi = Sheet9.Range("A10000").End(xlUp).Row + 1
With Sheet9
.Range("A" & dong_cuoi) = txt_SOPnumber.Text
.Range("B" & dong_cuoi) = txt_process_cat.Text
.Range("C" & dong_cuoi) = txt_process_subcat.Text
.Range("D" & dong_cuoi) = txt_process_question.Text
Dim img_name As String
If Dir(ThisWorkbook.Path & Application.PathSeparator & "Images", vbDirectory) = "" Then
MkDir (ThisWorkbook.Path & Application.PathSeparator & "Images")
End If
img_name = ThisWorkbook.Path & Application.PathSeparator & "Images" & Application.PathSeparator & Format(Now, "DDMMYYYHHMMSS") & ".jpg"
FileCopy Me.txt_Image_URL.Value, img_name
.Range("F" & dong_cuoi) = img_name

End With
MsgBox "Pls expect the answer after 5 WDs. If it's an urgent case, let us know via MS team"


End Sub
 
Cách đó là upload lên thư mục trên ổ đĩa của máy tính hiện tại rồi.

SharePoint thì điều khiển qua API chứ.
 
Upvote 0
Thân chào cả nhà GPEX,

Nhờ cả nhà hỗ trợ tìm lỗi giúp em code này với ạ.

Em đang dùng userform cho file được lưu sẵn ở Sharepoint với mong muốn:
1. upload ảnh từ Laptop
2. Khi submit form thì sẽ tự động upload ảnh lên folder cố định ở Sharepoint lưu file excel
3. add link ảnh vào file excel được trỏ tới.

Tuy nhiên, kết quả ra đúng nhưng khi mở ảnh từ link ở file excel thì bị lỗi. Nhờ cả nhà chỉ em với ạ!
Em cám ơn cả nhà rất nhiều ạ!

Private Sub Img_process_Submit_Click()
Dim dong_cuoi As Long
dong_cuoi = Sheet9.Range("A10000").End(xlUp).Row + 1
With Sheet9
.Range("A" & dong_cuoi) = txt_SOPnumber.Text
.Range("B" & dong_cuoi) = txt_process_cat.Text
.Range("C" & dong_cuoi) = txt_process_subcat.Text
.Range("D" & dong_cuoi) = txt_process_question.Text
Dim img_name As String
If Dir(ThisWorkbook.Path & Application.PathSeparator & "Images", vbDirectory) = "" Then
MkDir (ThisWorkbook.Path & Application.PathSeparator & "Images")
End If
img_name = ThisWorkbook.Path & Application.PathSeparator & "Images" & Application.PathSeparator & Format(Now, "DDMMYYYHHMMSS") & ".jpg"
FileCopy Me.txt_Image_URL.Value, img_name
.Range("F" & dong_cuoi) = img_name

End With
MsgBox "Pls expect the answer after 5 WDs. If it's an urgent case, let us know via MS team"


End Sub
Tiện dụng và cho ra kết quả chính xác nhất thì dùng Graph API thôi.
 
Upvote 0
Web KT

Bài viết mới nhất

Back
Top Bottom