Page 1 of 2 12 LastLast
Results 1 to 40 of 63

Thread: Change Image in .DOT file [RESOLVED II]

  1. #1

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Resolved Change Image in .DOT file [RESOLVED II]

    What would be the best way to have a user be able to switch the image that is in the .dot fille that we use in a mm? The ways that I can think of to do it woud be to:

    Link the file to the app.path with a static file name and load it every time. client would rename his filename to ours to change it.

    link the file to registry entry, and change the .dot and registry from within the vb program

    have client open .dot file and change the actual picture when they want to change it.

    Which is the best/easiest way to do it? How hard is it to have the document load a filename programmatically?

    Thanks. This just came up.
    Last edited by dglienna; Mar 3rd, 2005 at 10:46 PM.

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

    Re: Change Image in .DOT file

    David, the easiest way is to have the image linked and not embedded. Then in your vb program you can let
    the user browse for an image. Then you can copy it to the app.path dir or a hidden sub dir and rename the file so
    it matches the linked path.

    VB Code:
    1. 'In Words VBA or convert code to VB6
    2. Private Sub Document_Open()
    3.     LoadLogo
    4. End Sub
    5.  
    6. Private Sub LoadLogo()
    7.     'Linked picture
    8.     Selection.InlineShapes.AddPicture FileName:="C:\Documents and Settings\VB-Guru\My Documents\My Pictures\DOS1.gif", _
    9.     LinkToFile:=True, SaveWithDocument:=True
    10. End Sub
    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

  3. #3

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Change Image in .DOT file

    That sounds good. I'll try to implement it tomorrow, and get back to you. I think I want to do this in VB, not VBA, so could you show me the way to address the image from VB?

    Thanks.

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

    Re: Change Image in .DOT file

    Something like this...
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Command1_Click()
    4.     Dim oApp As Word.Application
    5.     Dim oDoc As Word.Document
    6.     Set oap = New Word.Application
    7.     oApp.Visible = True
    8.     Set oDoc = oApp.Documents.Open("C:\MM.dot")
    9.     oDoc.Bookmarks.Item("CompanyLogo").Select
    10.     Selection.InlineShapes.AddPicture "C:\Documents and Settings\VB-Guru\My Documents\My Pictures\DOS1.gif", True, True
    11. End Sub
    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

  5. #5

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Change Image in .DOT file

    Allright, I made the picture in the .dot a bookmark, but when I run the program, it adds another picture to the page. I want to replace the image.
    I called my bookmark "HomePicture". Also, how do you auto-size it so that the size doesn't change on the page? I'd like it to fit in the bookmark.
    Do I need some kind of a range?

    Thanks.
    Last edited by dglienna; Feb 25th, 2005 at 08:04 PM.

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

    Re: Change Image in .DOT file

    Try this.
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Command1_Click()
    4.     Dim oApp As Word.Application
    5.     Dim oDoc As Word.Document
    6.     Set oap = New Word.Application
    7.     oApp.Visible = True
    8.     Set oDoc = oApp.Documents.Open("C:\MM.dot")
    9.     oDoc.Bookmarks.Item("CompanyLogo").Select
    10.     Selection.InlineShapes.Item(1).Delete
    11.     oDoc.Bookmarks.Item("CompanyLogo").Select
    12.     Selection.InlineShapes.AddPicture "C:\Documents and Settings\VB-Guru\My Documents\My Pictures\DOS1.gif", True, True
    13. End Sub
    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

  7. #7

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Change Image in .DOT file

    Error on this line
    VB Code:
    1. Selection.InlineShapes.Item(1).Delete

    Requestd member of collection does not exist.

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

    Re: Change Image in .DOT file

    Try placing the filename or filename and path in there instead.
    Do you have a count > 0?
    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

  9. #9

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Change Image in .DOT file

    VB Code:
    1. Set oDoc = oApp.Documents.Open(RealPath & "Flyer.dot")
    2.     oDoc.Bookmarks.Item("HomePicture").Select
    3.     Selection.InlineShapes("HomePicture").Delete
    4.     oDoc.Bookmarks.Item("HomePicture").Select
    5.     Selection.InlineShapes.AddPicture .FileName, True, True

    Type mismatch on the .Delete
    there is only the one picture/bookmark
    Last edited by dglienna; Feb 25th, 2005 at 08:46 PM.

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

    Re: Change Image in .DOT file

    Try using the .Delete on the Selection object only.
    VB Code:
    1. Private Sub Command1_Click()
    2.     Set oDoc = oApp.Documents.Open(RealPath & "Flyer.dot")
    3.     oDoc.Bookmarks.Item("HomePicture").Select
    4.     Selection.Delete
    5.     oDoc.Bookmarks.Item("HomePicture").Select
    6.     Selection.InlineShapes.AddPicture .FileName, True, True
    7. End Sub
    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

  11. #11

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Change Image in .DOT file

    Now, it doesn't delete the old picture, and places the new picture to the right of the old one. Getting closer...

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

    Re: Change Image in .DOT file

    .Cut should do it. Replace the Selection.Delete line with Selection.Cut.
    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

  13. #13

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Change Image in .DOT file

    It didn't delete it, but the replacement image got smaller.
    That's strange!

  14. #14

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Change Image in .DOT file

    It won't delete the image. I just checked. The Bookmark is called HomePicture, and goto selects it. The other image gets pasted to the right of it, and pushes everytihing else down the page.

    i have switched to a .doc to simplify saving it for now...

  15. #15

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Change Image in .DOT file

    It's not cutting or deleting the bookmark, but is moving the cursor there, and then adding an image. isn't there a replace of some sort? i can't imagine why it doesn't work?

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

    Re: Change Image in .DOT file

    I have no idea why these methods aren't working. They work on mine. There is a .Reset method. It basically reset the image from its filename. Why do you need to delete th eimage if your renaming the selected image? Just rename the selected image and do a .Reset to refresh to the new image.
    VB Code:
    1. 'ActiveDocument.InlineShapes(1).Select
    2. 'ActiveDocument.InlineShapes(1).Delete
    3. ActiveDocument.InlineShapes(1).Reset
    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

  17. #17

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Change Image in .DOT file

    I don't know how he got the image in there initially. It is not linked to a file. I will try to use reset, but it may be something about the way it is set up. The image that is there is a sample. We want the client to choose the image that goes out on the mailmerge. Would it help if I linked the file to begin with?

  18. #18

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Change Image in .DOT file

    Nope. Still does the same thing. Should I upload the doc and the image? I don't know what else to do?

    It has word art before the picture, and i just ended up replacing the word art using the ActiveDocument coding here.

    VB Code:
    1. oDoc.Bookmarks.Item("HomePicture").Select
    2.     ActiveDocument.InlineShapes(1).Select
    3.     Selection.Cut
    4.     ActiveDocument.InlineShapes.AddPicture .FileName, True, True
    5.     ActiveDocument.InlineShapes(1).Reset
    Last edited by dglienna; Feb 25th, 2005 at 09:42 PM.

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

    Re: Change Image in .DOT file

    Yes, other then deleting the embedded image the .Reset .Cut .Delete are not working for some reason.

    Attach the document and I'll check it out.
    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

  20. #20

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Change Image in .DOT file

    All I managed to do was to change the size of the first wordart with the reset.
    something is not right. hope you can figure it out.
    Last edited by dglienna; Feb 25th, 2005 at 09:57 PM.

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

    Re: Change Image in .DOT file

    Oh, its a wordart object. Different issue then. I will check it out.
    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

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

    Re: Change Image in .DOT file

    Ok, I got most of it. Its a Shape object and not a InlineImage or WordArt object. This is a pain to position
    and format so I will leave that up to you This will delete the picture (finally) and add a new picture
    shape. Then you need to format it and position it so its the same as the original. I did some of the formatting
    and positioning to help get you started.

    VB Code:
    1. Private Sub Command1_Click()
    2.     Dim oDoc As Word.Document
    3.     Set oDoc = ActiveDocument
    4.     oDoc.Shapes(1).Delete
    5.     oDoc.Shapes.AddPicture FileName:="D:\Development\About1.gif", LinkToFile:=True, SaveWithDocument:=True ', _
    6.     'Left:=-999998, Top:=0, Width:=189, Height:=125.25, Anchor:=0
    7.     'Positioning:
    8.     oDoc.Shapes(1).Select 'True
    9.     oDoc.Shapes(1).Left = 0 '-999998
    10.     oDoc.Shapes(1).Top = 200
    11.     oDoc.Shapes(1).Width = 189
    12.     oDoc.Shapes(1).Height = 125.25
    13.     'Formatting:
    14.     Selection.ShapeRange.WrapFormat.Type = wdWrapSquare
    15.     Selection.ShapeRange.RelativeHorizontalPosition = wdRelativeHorizontalPositionColumn
    16.     Selection.ShapeRange.RelativeVerticalPosition = wdRelativeVerticalPositionParagraph
    17.     Selection.ShapeRange.LockAspectRatio = msoTrue
    18. End Sub
    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

  23. #23

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Change Image in .DOT file

    Thanks. I'll look into it later, and get back to you.

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

    Re: Change Image in .DOT file

    Seems like it would have been easier to replace the file with the selected file with the same name and then
    refresh the link? But anyways, the posted code will get you the results you wanted.
    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

  25. #25

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Change Image in .DOT file

    unless there is an option to deal with different sized images, i think it was all for moot. it really is a shame, but if you are out of ideas, then I guess that's it.

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

    Re: Change Image in .DOT file

    Guess you missed my demo code???
    VB Code:
    1. oDoc.Shapes(1).Width = 189
    2. oDoc.Shapes(1).Height = 125.25
    This part resizes the image to what ever you need. I got it to work on mine but I wasnt going
    to fiddle with it so it was perfect. Thats why I said I would get you started on the formatting. Its allot of work.
    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

  27. #27

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Change Image in .DOT file

    Oh. I don't know what happened when I tried it with a big image. I assumed it wasn't doing anything to the original image that I pasted. My apologies.

    Can I do the same thing to an Picturebox? I had autoresize on, and the box changed sizes off of the form, and when I turned it off, the picture didn't scale.
    Do I just give it the same parameters? (is that in Twips?)

    Also, I noticed a tool that might work. CentimetersToPoints(6)
    Is it referring to twips?

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

    Re: Change Image in .DOT file

    Its only for converting centimeters to points. From the help file;
    CentimetersToPoints:
    Converts a measurement from centimeters to points (1 cm = 28.35 points). Returns the converted measurement as a Single.
    It doesnt specify what points refer to.
    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

  29. #29

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Change Image in .DOT file

    I got it. I was using a Picturbox, and switched to an Imagebox, and things are autosizing correctly. That wraps it up.

  30. #30

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    One more quick one...

    On my system, the replace works fine, but on the tester's system, a save-as dialog popped up asking to save the page with the new image

    Does odoc.close false save the document, or do I need to explicitly save it with the same filename? Is that odoc.save "filename" ? or do i need some way to automate the replace dialog box?

    Why didn't I get the error on my system?

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

    Re: Change Image in .DOT file [RESOLVED]

    odoc.close false does not save the document. This is what the False specified - do not save changes.

    Are your users running the same version of Word as you?
    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

  32. #32

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Change Image in .DOT file [RESOLVED]

    I have xp and he has 2003, but I want to support all versions of word.
    I didn't save it on my system, and it updated the image.
    How do i call the save statement to update the file?

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

    Re: Change Image in .DOT file [RESOLVED]

    To save the current document.
    VB Code:
    1. oDoc.Save
    Or to save it as something else ...
    VB Code:
    1. oDoc.SaveAs FileName:="Text.rtf", FileFormat:=wdFormatRTF
    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

  34. #34

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Change Image in .DOT file [RESOLVED]

    tester has word 2002 on desktop and word 2003 on laptop.

    odoc.save is prompting to save. how do we get rid of it, and save?

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

    Re: Change Image in .DOT file [RESOLVED]

    VB Code:
    1. oDoc.SaveAs FileName:="MyDocument.doc",  FileFormat:=wdFormatDocument
    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

  36. #36

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Change Image in .DOT file [RESOLVED]

    We still seem to have a problem.

    Seems to happen on the second run, on the first run through, it works fine. I then select the second image, and get this.

    We moved things arond on the page so that there is no more word wrap. The text is now below instead.
    Attached Images Attached Images   
    Last edited by dglienna; Mar 1st, 2005 at 11:29 PM.

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

    Re: Change Image in .DOT file [Almost RESOLVED]

    Is Word being closed by the user between runs? This is usually the cause of 429. Attach a sample doc.
    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

  38. #38

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Change Image in .DOT file [Almost RESOLVED]

    Dang. Didn't see your post. Yes, it is being closed. Something might be opening another intance, though. When it crashes, I find WinWord in my list of processes.

    EDIT: Updated
    Last edited by dglienna; Mar 3rd, 2005 at 01:23 AM.

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

    Re: Change Image in .DOT file [Almost RESOLVED]

    Multiple instances of WinWord? If so this is part of the problem.

    I will look into your doc tonight when I have enough time to get into it. Allot of work right now.
    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

  40. #40

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Change Image in .DOT file [Almost RESOLVED]

    Also, is there a way to create a space before the first entry in the table below the picture. it seems to overwrite the price no matter what I do. i've tried various breaks and nothing worked.

    The multiple instance came from the error halting the program while word was still open. Ending the program left the instance. That is the only way that there were two instances.

    If you want to see the code, let me know. Not much else has changed.

    I'm posting the newer one now.
    Attached Images Attached Images  
    Last edited by dglienna; Mar 2nd, 2005 at 04:37 PM.

Page 1 of 2 12 LastLast

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