From: Robin on 24 Dec 2009 04:22 I have a few more details that maybe resolves some issues here... The pictures in the document (or template) we are using have been inserted by the Insert > Picture function. There is no way that I can access the field in the Word GUI for this type of insertion, for example using ALT+F9. I guess it's not even a field definition that's used. However, if I use the Insert > Quick Parts > Field > Include Picture function, then the INCLUDEPICTURE field is applied and is accessible using ALT+F9, but only if the picture has its text wrapping set to inline. So the macro would work for these types of pictures, but not those inserted using Insert > Picture. All the inserted pictures that we use have been included using the Insert > Picture function. They are also not inline, but set to be behind text. So would I have to would use some Picture object property to change the file reference for each of these and not use the Field.Code.Text property? Sorry about all the details and confusion, but appreciate the help. Robin
From: macropod on 24 Dec 2009 05:40 Hi Robin, For some reason, Word 2007 doesn't allow access to field codes in documents with the docx or docm format. I'm not sure how to code around that, though working through the Shapes and Inlineshapes collections might work. Curiously, saving the same document in the Word 97-2003 doc format allows access to the field codes (eg via Alt-F9). -- Cheers macropod [Microsoft MVP - Word] "Robin" <Robin(a)discussions.microsoft.com> wrote in message news:B651C584-18F2-48C0-80E5-1B6E4D873095(a)microsoft.com... >I have a few more details that maybe resolves some issues here... > > The pictures in the document (or template) we are using have been inserted > by the Insert > Picture function. There is no way that I can access the field > in the Word GUI for this type of insertion, for example using ALT+F9. I guess > it's not even a field definition that's used. > > However, if I use the Insert > Quick Parts > Field > Include Picture > function, then the INCLUDEPICTURE field is applied and is accessible using > ALT+F9, but only if the picture has its text wrapping set to inline. So the > macro would work for these types of pictures, but not those inserted using > Insert > Picture. > > All the inserted pictures that we use have been included using the Insert > > Picture function. They are also not inline, but set to be behind text. So > would I have to would use some Picture object property to change the file > reference for each of these and not use the Field.Code.Text property? > > Sorry about all the details and confusion, but appreciate the help. > Robin
From: Peter Jamieson on 24 Dec 2009 06:49 FWIW when you save as .docx/.docm in this scenario, I do not believe the field code is saved at all. What seems to be saved is a. a "relationship" that specifies the pathname of the image file. Interestingly enough, this is a relative pathname b. a copy of the image, renamed, inside a "media" folder within the ..docx - e.g. it may be named image1.jpeg c. a relationship that specifies that image's pathname within the .docx. I haven't had time to pursue it beyond that, but modifing the first relationship manually and replacing image1.jpeg with the second image does cause the .docx to open with the new picture in it as you might hope. There may be additional info. in the document .xml (I haven't looked) but with any luck everything Word actually needs to display the correct picture will be in those relationships and copied image files. If you can't access/modify the image pathname from the Word object model, I guess the only thing for it - other than stick to .doc format - is to try to do it by directly manipulating the OOXML. Not something I have code for at this point. Peter Jamieson http://tips.pjmsn.me.uk On 24/12/2009 10:40, macropod wrote: > Hi Robin, > > For some reason, Word 2007 doesn't allow access to field codes in > documents with the docx or docm format. I'm not sure how to code around > that, though working through the Shapes and Inlineshapes collections > might work. Curiously, saving the same document in the Word 97-2003 doc > format allows access to the field codes (eg via Alt-F9). >
From: Robin on 24 Dec 2009 06:57 Yes that was my impression as well - and 2007 crashes dismally when trying to update a link to an image placed in a header quick list. I have to try and find all sorts of workarounds here and appreciate your help tremendously. Robin
First
|
Prev
|
Pages: 1 2 3 Prev: Template lookup to SQL Server DB value Next: ActiveDocument.SaveAs with EFS |