L
Levv
I was trying to use VBA in Word to import about 60 picture files into
word (with the HPGL file format).
I recorded a macro (insert menu, picture -> from file) and modified it
to make it into a for loop. I am running into a problem. The program
works fine for inserting the first few picture files and then gives an
error saying the filename is not recognized. (But I think the
filenames are correct.)
I think the program works for the first few files because I have
already inserted those ones manually using the insert menu in word.
Is there any way to fix this problem or get around it?
Here is part of my code:
Sub Macro1()
Dim busNo(1 To 200)
busNo(1) = 901
busNo(2) = 903
.........
For i = 1 To 62
Selection.InlineShapes.AddPicture FileName:= _
"D:\v29jul06\gstr_" & busNo(i), _
LinkToFile:=False, SaveWithDocument:=True
Next i
End Sub
word (with the HPGL file format).
I recorded a macro (insert menu, picture -> from file) and modified it
to make it into a for loop. I am running into a problem. The program
works fine for inserting the first few picture files and then gives an
error saying the filename is not recognized. (But I think the
filenames are correct.)
I think the program works for the first few files because I have
already inserted those ones manually using the insert menu in word.
Is there any way to fix this problem or get around it?
Here is part of my code:
Sub Macro1()
Dim busNo(1 To 200)
busNo(1) = 901
busNo(2) = 903
.........
For i = 1 To 62
Selection.InlineShapes.AddPicture FileName:= _
"D:\v29jul06\gstr_" & busNo(i), _
LinkToFile:=False, SaveWithDocument:=True
Next i
End Sub