Bryan Carbonnell
carbonnb at sympatico.ca
Sun Dec 11 10:13:13 CST 2005
Welcome Back Jürgen, If nothing else, you are making our collective brains hurt :-)) Some comments and suggestions in-line On 9 Dec 2005 at 12:16, Jürgen Welz wrote: > Here's the question. When I tried implemeting this last time, the > macro recorder in Word would record the insertion of a graphic, but I > could not do a thing with the graphic while the recorder was running. > I think that the Picture toolbar was unavailable in Access 97 and > 2000. In Word 2003, I can select items on the Picture toolbar, but I > can't select the graphic to apply the action to the graphic. If I > select the graphic before impelementing the macro recorder, it remains > selected, but if I select a picture toolbar button, I still cannot > affect the graphic. The problem with the macro recorder, in case you didn't already know, is that when the macro recorder is running is that a lot of mouse commands aren't available. You will need to use the equivilent keyboard commands, IF they exists. Otherwise, you will need to figure out how to affect the changes in VBA without the help of a recorded macro. Now onto the problem at hand, not being able to modify the image. To modify an image in VBA and have access to everything that is available in the format picture dialog box, you first need to convert it into a Word Shape from a Word InLine Shape. Assuming that the image you want to work with is the first image in the InLineShapes collection, you'd need to do something like ActiveDocument.InlineShapes(1).ConvertToShape Then you will need to set the WrapFormat Type to the wrapping format you want. ActiveDocument.Shapes(1).WrapFormat.Type = wdWrapTight Then you can move it using the .Top and .Left property of the Shapes collection ActiveDocument.Shapes(1).Top = 0 ActiveDocument.Shapes(1).Left = 0 That puts it in the top left corner of the page that the image is on. And to scale it, use scalewidth and scaleheight ActiveDocument.Shapes(1).ScaleWidth 0.37, msoTrue ActiveDocument.Shapes(1).ScaleHeight 0.37, msoTrue This will resize it to 37% of the original height and width relative to the original size. So a full snippet would look something like: Dim shp As Shape Set shp = ActiveDocument.InlineShapes(1).ConvertToShape With shp .WrapFormat.Type = wdWrapTight .Top = 0 .Left = 0 .ScaleWidth 0.37, msoTrue .ScaleHeight 0.37, msoTrue End With Set shp = Nothing > I'l like to movesize the graphic to a specified location with a > standard height that is different for the 1st and subsequent page logo > and also different from the default size of the graphic when inserted. Now, to deal with the logo on the second page, the image has to start out on the second page. You just need to make sure that when you hit the line Set shp = ActiveDocument.InlineShapes(1).ConvertToShape you are dealing with the correct item in the InLineShapes collection. > I have been asked to implement a logo change immediately, but the > current version of a typical version is 1,736 bytes and the outlines > are too obviously segmented for me to manually change all the logos > now, only to redo it again with improved files a month from now. Here is a suggestion, and I don't know how well it will work for your environment, but how about creating a Word template wizard to build the template on the fly? You can have the user select the type of template they want to create, the logo they will use, etc. And in the wizard you can embed the image at creation time, that way when the logos change, you just have to update the logo and not all the templates. Hopefully some of this will be of help. -- Bryan Carbonnell - carbonnb at sympatico.ca If you're too open-minded, your brains will fall out.