VBA检查sharepoint documnets库中是否存在文件夹,如果不是,则创建它 [英] VBA check if folder exist on sharepoint documnets library and if not than create it

查看:98
本文介绍了VBA检查sharepoint documnets库中是否存在文件夹,如果不是,则创建它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我想在sharepoint上创建文件夹。我想用excel vba代码来检查文件夹是否存在,如果不是,则创建文件夹。我试过下面的代码,但它给了我运行时错误52:错误的文件名或数字

I want to create folder on sharepoint. I want to user excel vba code to check if folder exist and if not than create folder. I have tried below code but it gives me run time error 52: Bad file name or number




Sub test()
Dim SpPath As String
dim strfoldername as string

strfoldername= "Test"
SpPath  = "\\pathtosharepoint.aspx#\Shared%20Documents\strfoldername"


 If Dir(SpPath, vbDirectory) = "" Then
        MkDir SpPath
 End If
 
 End Sub

我已经替换了"/"用"\"但仍然代码不起作用。

I have replace "/" with "\" but still code do not work.

谢谢,

Zav




推荐答案

SpPath = "\\pathtosharepoint.aspx#\Shared%20Documents\" & strfoldername


您的路径连接代码不正确,您可能想尝试使用空格而不是%20

Your code for the path concatenation is incorrect, and you might want to try using a space instead of %20


这篇关于VBA检查sharepoint documnets库中是否存在文件夹,如果不是,则创建它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆