#1
|
|||
|
|||
Insert a picture into word using DDE (Dynamic Data Exchange)
I'm working with a template document and using DDE in SAS. I have created filename for the bookmark of the picture, that is a textbox where I can insert the picture in. However I can't insert the picture and neither SAS nor Word giving me an error. Could some one help me out? Here are the SAS codes. I also input some data into other bookmarks of the document and it worked. Any help would be appreciated.
filename pic dde 'winword|C:\Users\survey.doc!pic' ; data _null_; put '[EndOfDocument]'; put '[InsertPara]'; put '[InsertPicture.Name="C:\Users\picture.jpg"]'; put '[CharLeft 1,1]'; put '[FormatPicture.ScaleX="100%",.ScaleY="100%"]'; put '[CharRight 1,0]'; put '[InsertPara]'; run; |
#2
|
||||
|
||||
Hi sasdde,
I know nothing of SAS, but from from I can see in your code there is no reference to either a textbox or a bookmark. You say you've been able to insert the picture into the document using a bookmark. Have you tried putting the bookmark inside the textbox? Also, when inserting a picture into a textbox, it has to be inserted in the 'in-line with text' format (ie as an inlineshape). As I understand it, you can impelement both Wordbasic and VBA in SAS. The VBA equivalent would be: Code:
ActiveDocument.InlineShapes.AddPicture "C:\Users\picture.jpg", , , ActiveDocument.Shapes(1).TextFrame.TextRange or With ActiveDocument.Shapes(1).TextFrame .TextRange.InlineShapes.AddPicture "C:\Users\picture.jpg", , , .TextRange End With Code:
ActiveDocument.InlineShapes.AddPicture "C:\Users\picture.jpg", , , ActiveDocument.Bookmarks("BkMk").Range or With ActiveDocument.Bookmarks("BkMk") .Range.InlineShapes.AddPicture "C:\Users\picture.jpg", , , .Range End With As you can see, with the bookmark, there's no need to reference the textbox, or know which of any number of shapes in the document it might be.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Thank you Macropod! I did more research on my question yesterday and you pointed out my problem. I didn't reference the bookmark or textbox. GOTO method didn't go to the bookmark in subdocument (ex. textbox). Your codes might be helpful however SAS is not smart enough to work with VBA but WordBasic. I found that no WordBasic Help available in MS website. Is that too old to use that? I have to transfer your codes into WordBasic. I have no knowledge of that. Could you give me some help?
|
#4
|
|||
|
|||
Hi Macropod,
I have fixed the problem. Thank you for your help. |
#5
|
||||
|
||||
For future reference re WordBasic, you might be interested in: http://msdn.microsoft.com/en-us/libr...ffice.11).aspx
Although the pages are for converting WordBasic to Visual Basic, which is the probably opposite of what you want, the info's all there. Sort of like working out what the question is when you only know the answer ...
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#6
|
|||
|
|||
Hi sasdde
Could you by any chance help me with inserting an image from a bookmark? I have been all over and this is the first time I have seen anybody that have been able to do this. Even if it is just a link to how it is done. I am really at my wits end with this. Thank you |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Insert picture background in Word mail merge labels | obasanla | Mail Merge | 6 | 11-26-2012 11:53 PM |
VBA: Include Dynamic Sheet Name In Pivot Table Source Data | ibrahimaa | Excel Programming | 2 | 04-28-2012 12:27 AM |
word insert data into excel | elemental | Word | 1 | 04-29-2011 06:33 PM |
Macro for Picture Insert | rfhall50 | Word VBA | 2 | 10-25-2010 12:41 PM |
Can I insert a picture into a picture ? | alexcalgary | Drawing and Graphics | 2 | 10-16-2010 03:29 PM |