Mattantaliss
Board Regular
- Joined
- Sep 6, 2005
- Messages
- 52
Hello,
First off, this is all with Office 2010 running on Windows 7.
I have inserted a (not linked) picture in an Excel worksheet. The idea is to be able to send the single Excel file to someone and have the picture included, instead of sending two separate files. Now what I want to do is use that picture in the header of a Word document that I am creating via VBA code. The problem I am running into is getting the picture from the Excel worksheet to the Word document and positioning it correctly (at the top of the page).
On one hand, I could do something like
or, on the other hand, I can copy the image and do
Note: appWord is a Word.Application, and the italicized bits are placeholders for what I would actually have in there.
With the first option, I need to know the filename. That means I need to either have the image be a separate file or I need to know the full path of an embedded picture. With the second option, I can not figure out how to access and reposition the pasted image in Word.
Does anyone know how I can go about getting the desired outcome? At this point, I'm basically hunting for something like a version of .AddPicture that will take a shape instead of a string (filename).
First off, this is all with Office 2010 running on Windows 7.
I have inserted a (not linked) picture in an Excel worksheet. The idea is to be able to send the single Excel file to someone and have the picture included, instead of sending two separate files. Now what I want to do is use that picture in the header of a Word document that I am creating via VBA code. The problem I am running into is getting the picture from the Excel worksheet to the Word document and positioning it correctly (at the top of the page).
On one hand, I could do something like
Rich (BB code):
appWord.ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Shapes. _
AddPicture(Filename, LinkToFile:=False, SaveWithDocument:=True, _
Top:=InchesToPoints(-1 * HeaderMarginInches)).RelativeVerticalPosition = _
wdRelativeVerticalPositionPage
Rich (BB code):
appWord.ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range. _
PasteSpecial Link:=False, Placement:=wdInLine, DisplayAsIcon:=False
Note: appWord is a Word.Application, and the italicized bits are placeholders for what I would actually have in there.
With the first option, I need to know the filename. That means I need to either have the image be a separate file or I need to know the full path of an embedded picture. With the second option, I can not figure out how to access and reposition the pasted image in Word.
Does anyone know how I can go about getting the desired outcome? At this point, I'm basically hunting for something like a version of .AddPicture that will take a shape instead of a string (filename).