Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-04-2013, 10:27 AM
sasdde sasdde is offline Insert a picture into word using DDE (Dynamic Data Exchange) Windows 7 64bit Insert a picture into word using DDE (Dynamic Data Exchange) Office 2010 64bit
Novice
Insert a picture into word using DDE (Dynamic Data Exchange)
 
Join Date: Mar 2013
Posts: 3
sasdde is on a distinguished road
Question 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;
Reply With Quote
  #2  
Old 03-05-2013, 06:46 AM
macropod's Avatar
macropod macropod is offline Insert a picture into word using DDE (Dynamic Data Exchange) Windows 7 64bit Insert a picture into word using DDE (Dynamic Data Exchange) Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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
where the textbox is the first shape object in the document. If you put a bookmark into the shape, though, the code becomes:
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
where 'BkMk' is your bookmark name.

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]
Reply With Quote
  #3  
Old 03-05-2013, 08:55 AM
sasdde sasdde is offline Insert a picture into word using DDE (Dynamic Data Exchange) Windows 7 64bit Insert a picture into word using DDE (Dynamic Data Exchange) Office 2010 64bit
Novice
Insert a picture into word using DDE (Dynamic Data Exchange)
 
Join Date: Mar 2013
Posts: 3
sasdde is on a distinguished road
Default

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?
Reply With Quote
  #4  
Old 03-05-2013, 10:35 AM
sasdde sasdde is offline Insert a picture into word using DDE (Dynamic Data Exchange) Windows 7 64bit Insert a picture into word using DDE (Dynamic Data Exchange) Office 2010 64bit
Novice
Insert a picture into word using DDE (Dynamic Data Exchange)
 
Join Date: Mar 2013
Posts: 3
sasdde is on a distinguished road
Default

Hi Macropod,

I have fixed the problem. Thank you for your help.
Reply With Quote
  #5  
Old 03-05-2013, 08:08 PM
macropod's Avatar
macropod macropod is offline Insert a picture into word using DDE (Dynamic Data Exchange) Windows 7 64bit Insert a picture into word using DDE (Dynamic Data Exchange) Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #6  
Old 06-21-2013, 01:21 AM
BulletVictim BulletVictim is offline Insert a picture into word using DDE (Dynamic Data Exchange) Windows 7 64bit Insert a picture into word using DDE (Dynamic Data Exchange) Office 2007
Novice
 
Join Date: Jun 2013
Posts: 1
BulletVictim is on a distinguished road
Default

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
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert a picture into word using DDE (Dynamic Data Exchange) Insert picture background in Word mail merge labels obasanla Mail Merge 6 11-26-2012 11:53 PM
Insert a picture into word using DDE (Dynamic Data Exchange) VBA: Include Dynamic Sheet Name In Pivot Table Source Data ibrahimaa Excel Programming 2 04-28-2012 12:27 AM
Insert a picture into word using DDE (Dynamic Data Exchange) word insert data into excel elemental Word 1 04-29-2011 06:33 PM
Insert a picture into word using DDE (Dynamic Data Exchange) Macro for Picture Insert rfhall50 Word VBA 2 10-25-2010 12:41 PM
Insert a picture into word using DDE (Dynamic Data Exchange) Can I insert a picture into a picture ? alexcalgary Drawing and Graphics 2 10-16-2010 03:29 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:50 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft