PDA

View Full Version : Embedded Objects



gunny2k9
01-11-2011, 06:41 AM
Ok basicly i have a Word VBA project using forms , which will paste in data from a table to the word document and will run its code on the table, what i do is select the whole doc and delete just in case somethings there thats not ment to be, but thats not the issue just info.

right what i m playing around with is that i ve embedded a PDF doc (user guide basicly) as an object which only displays the icon and with a button on a form that activates the PDF ..works fine


ActiveDocument.InlineShapes(1).OLEFormat.Activate


however as i need the page to use for data processing an object on the page isnt ideal, you can place it in the Header but then you get error...



Run-time error 5941
the requested member of the collection does not exist


ok fine fair enough so then make code that goes into the header, activates the object then comes out of the header
( used macro recorder )


If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader

ActiveDocument.InlineShapes(1).OLEFormat.Activate

If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader


you get the same error :banghead:

..in excel i know you can make a Worksheet with an object , Hide it and then run VBA that will unhide, ativate the object and hide the sheet again (so that the user has no idea its there)

basicly i wanna do that in word and please dont say use Excel as this needs to be in word !!!

not bothered about hidding the objects/icons, just need a way to put them out of the way....

yes i can supply the docs seperately (say zip them in an archive and email it) but this is being run from a network and the Drive where they are stored is Mapped differently on some PCs so just doing a link to


\\whatever\files\doc.doc

isnt viable

any one know a way of doing this ? or got any bright ideas ?

macropod
01-11-2011, 01:52 PM
Hi gunny29k,

Try something based on:

ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.InlineShape s(1).OLEFormat.Activate

gunny2k9
01-12-2011, 12:21 AM
cheers that works nicely ;)