Results 1 to 5 of 5

Thread: Replace Object

  1. #1

    Thread Starter
    Lively Member safewithyou247's Avatar
    Join Date
    Dec 2005
    Posts
    64

    Replace Object

    How do I replace a shape with a copy of another shape. This is the code that I have so far.

    VB Code:
    1. With ActiveDocument.Shapes(1)
    2.    .Select
    3.    Selection.InlineShapes(1).Select
    4.    Selection.copy
    5.    .Select
    6.    ' Replace shape with inlineshape
    7. End with

    So I have a copy of the inline shape in the clipboard. And I have the shape that I want to replace selected. Now how do I go about replacing it?
    "A candle loses nothing by lighting another candle."

  2. #2
    New Member
    Join Date
    Jun 2006
    Posts
    6

    Re: Replace Object

    shape1.length = shape2.length
    shape1.height = shape2.height

    Is that what you mean?
    Are they both in the same application?

  3. #3

    Thread Starter
    Lively Member safewithyou247's Avatar
    Join Date
    Dec 2005
    Posts
    64

    Re: Replace Object

    Your post does not make sense to me.

    I am not sure what the length and the height of the shape have to do with replacing the shape. And being that this is a word document I dont see what different applications would refer to.

    Please clarify.
    "A candle loses nothing by lighting another candle."

  4. #4
    New Member
    Join Date
    Jun 2006
    Posts
    6

    Re: Replace Object

    I mis understood what you needed to do, i made a sugestion based on what i thought you needed but apparently i was well wide of the mark, sorry

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Replace Object

    Record a macro of you doing the task and then check out the generated module code. With a little tweaking it will be useful.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width