VBA 宏导出问题
VBA macro export Problems
我的代码有问题,它为每个 JPG 显示相同的数据我希望它根据 "Neighbourhood" 字段显示不同的数据,但我得到的只是 100 个显示相同数据的文件在我的出口,
这些文件使用所有不同的变量名导出,但都显示相同的数据
我觉得我遗漏了一些东西,但找不到解决方案
代码在下面
sub KnowYourNeighbourhood
ActiveDocument.Sheets("SH02").Activate
Set t=ActiveDocument.ActiveSheet
set field1 = ActiveDocument.Fields("Neighbourhood").GetPossibleValues
for i = 0 to field1.Count - 1
strNeighName = field1.item(i).Text
ActiveDocument.Fields("Neighbourhood").Select field1.Item(i).Text
Filepath = "H:\My Pictures\"
t.ExportBitmapToFile Filepath & strNeighName &".jpg"
next
ActiveDocument.ClearAll true
end sub
你是Allowing System Access
吗?
宏编辑器左边有个设置
我的代码有问题,它为每个 JPG 显示相同的数据我希望它根据 "Neighbourhood" 字段显示不同的数据,但我得到的只是 100 个显示相同数据的文件在我的出口, 这些文件使用所有不同的变量名导出,但都显示相同的数据
我觉得我遗漏了一些东西,但找不到解决方案
代码在下面
sub KnowYourNeighbourhood
ActiveDocument.Sheets("SH02").Activate
Set t=ActiveDocument.ActiveSheet
set field1 = ActiveDocument.Fields("Neighbourhood").GetPossibleValues
for i = 0 to field1.Count - 1
strNeighName = field1.item(i).Text
ActiveDocument.Fields("Neighbourhood").Select field1.Item(i).Text
Filepath = "H:\My Pictures\"
t.ExportBitmapToFile Filepath & strNeighName &".jpg"
next
ActiveDocument.ClearAll true
end sub
你是Allowing System Access
吗?
宏编辑器左边有个设置