xml - 在 VBA 中使用单元格中的文件路径
问题描述
我正在使用 VBA 中的 .xml 文件,并且我想让文件路径动态化,因为宏必须在许多不同的 .xml 文件上运行,所以每次我使用时都不需要编辑代码它。我尝试了以下方法,这使得文件的正确路径可以在即时窗口中正确打印,但它不会打开它。我正在引用 Microsoft XML,v3.0。
我如何也可以动态编辑代码的 SelectionNameSpaces 行?
Sub openxml()
Dim Obj as DOMDocument
Dim xmlpath as String
Set Obj=New DOMDocument
Obj.async=False
Obj.validateOnParse=False
xmlpath=ThisWorkbook.Worksheets(1).Range("B4").Value
Debug.Print xmlpath
'''Obj.SetProperty "SelectionNameSpaces", "xmlns:ns0='http://update.DocumentTypesSchema.myfile.Xml' " '''
If Obj.Load(xmlpath)=True Then
Msgbox ".xml uploaded"
Else
Msgbox ".xml not uploaded"
Exit Sub
End If
End Sub
解决方案
推荐阅读
- git - 即使在安装之后,如何处理缺少的 git.exe 错误?
- java - 在 Java 中屏蔽 XML 中的敏感数据的性能优化方法
- python - 如何过滤Pydatatable框架的I表达式中传递的多个值的观察?
- python - Postgres ON CONFLICT DO UPDATE only non null values in python
- azure - 在 Kusto 中,如何在使用“reduce”运算符时获得额外的列
- ios - IOS谷歌地图标记标题不出现
- javascript - 包含在 Webpack 4 中的部分渲染为文字而不是 HTML
- python - NoneType' 对象没有属性 'group' 错误。Python代码
- c# - 如何在 C# 中获取 SQL Server 的日期时间
- angular - 角度输入搜索无法使用 switchmap,同时还尝试显示一些初始化数据