Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Star Lounger
    Join Date
    Aug 2001
    Location
    Maine, USA
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Inserting Clipart Etc. (Word97(SR2))

    Does anyone know of a way to insert more than one graphic at a time?

    Better yet, in the good old days when I was using WordPerfect for DOS, I had a macro that would allow me to specify a directory, then create a blank document with a thumbnail of each graphic (and the graphic's filename) from that directory. Anybody know of anything similar I can use in Word?

    Thanks!

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Inserting Clipart Etc. (Word97(SR2))

    No, but for starters, try this one: <A target="_blank" HREF=http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Cat=&Board=wrd&Number=73752>http://www.wopr.com/cgi-bin/w3t/showthread...rd&Number=73752</A>.

  3. #3
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    199
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Re: Inserting Clipart Etc. (Word97(SR2))

    Hi,

    You might like to try this one which works in W97:

    <pre>
    Public Sub MAIN()
    Dim i
    Dim file$
    Dim j
    'Creates a Document of Clipart (or bmps) from the Current Directory
    'For bmps change the line that says *.wmf
    ' Dimension an array to hold the filenames of the images.
    ReDim f__$(200)
    ' Insert a three column table to provide a columnar place to
    ' display the images.
    WordBasic.TableInsertTable ConvertFrom:="", NumColumns:="3", _
    InitialColWidth:="Auto", Format:="16", Apply:="167"
    WordBasic.TableRowHeight AllowRowSplit:=0
    'TableInsertTable .NumColumns = "3"
    ' Loop through all the filenames that meet the specified
    ' image type using the Files$() function from WordBasic.
    i = 0
    file$ = WordBasic.[Files$]("*.wmf")
    'file$ = Files$("*.bmp")
    f__$(i) = file$
    While file$ <> ""
    file$ = WordBasic.[Files$]()
    i = i + 1
    f__$(i) = file$
    Wend
    ' Now that the filenames are stored in an array, loop
    ' through the array and bring in the images.
    For j = 0 To i - 1
    ' First insert the filename and a paragraph mark.
    WordBasic.Insert f__$(j)
    WordBasic.InsertPara
    ' Now insert the picture and some paragraph marks.
    ' Selection.InlineShapes.AddPicture (f__$(j), _
    LinkToFile:=False, SaveWithDocument:=True)
    WordBasic.InsertPicture f__$(j)
    WordBasic.CharLeft 1, 1
    WordBasic.CharRight
    WordBasic.InsertPara
    ' Use the NextCell command to generate a new row in the table.
    WordBasic.NextCell
    Next j
    End Sub
    </pre>


    Good Luck!

  4. #4
    Star Lounger
    Join Date
    Aug 2001
    Location
    Maine, USA
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Inserting Clipart Etc. (Word97(SR2))

    Thanks, Jefferson! As you can see in the post following yours, Peter Moran seems to have expanded on the filename routine. Between the two of you, I'm on the road.

  5. #5
    Star Lounger
    Join Date
    Aug 2001
    Location
    Maine, USA
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Inserting Clipart Etc. (Word97(SR2))

    Peter,
    Thank you! That looks like it will do the trick. I really appreciate your help (jscher2000's, too). You guys have saved me from reinventing an old wheel.

  6. #6
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Inserting Clipart Etc. (Word97(SR2))

    Jscher/Peter, I too used to use the macro that was available in WordPerfect to produce an index sheet of the contents of a graphics directory (which was available for many of the Windows versions as well as the DOS one) and would love to have something similar in Word.

    However, when I tried your macro it just produced six cell table with nothing in it! I'm sure I'm just being stupid, but where am I going wrong?!
    Beryl M


  7. #7
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    199
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Re: Inserting Clipart Etc. (Word97(SR2))

    Beryl,

    Sorry you had problems with the macro, but I do have one admission that may help - to get it on the board I had to insert a continuation in the line "Wordbasic.TableInsertTable..." so Iwould suggest that you remove the underscore on that line and combine the line with the next line. Otherwise check that you have it line for line and that you do not have any lines split.

    Hope this helps!

  8. #8
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Inserting Clipart Etc. (Word97(SR2))

    Peter

    Thanks for your response, but I had noticed the underscore, and it wasn't that line that's causing the problem, as far as I can tell. I copied your code en masse, via Word, into VBA direct, so it can't be a typing error (which in any case would cause a debug error, surely?).

    The impression I get is that it's running fine, but not finding any graphics to insert - so how do you tell it which directory to look in? I can't see which line it is that does this ...!
    Beryl M


  9. #9
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Inserting Clipart Etc. (Word97(SR2))

    This is not suitable for distribution, but as a quickie way to browse around for the right path, how about this:
    <pre>Dim strPicturePath As String
    With Dialogs(wdDialogInsertPicture)
    If .Display = 0 Then Exit Sub
    strPicturePath = .Path
    End With
    strPicturePath = Trim(InputBox("Edit this to the desired filespec (e.g., " & _
    "chotos*.jpg)", , strPicturePath))</pre>

    strPicturePath would then replace "*.wmf" in the Files$ command.

    If you want to build something more usable, look into the FileSearch object. I think it understands the concept of graphics files and could provide a more flexible solution.

  10. #10
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    199
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Re: Inserting Clipart Etc. (Word97(SR2))

    Beryl,

    I hope you had some success with Jefferson's suggestion.

    I have not found this a problem as I would usually go into the directory first using Word's FileOpen dialog box and with "Files of Type:" set as "All Files (*.*)" to see if there were *wmf files there before I ran the macro, and once you go into a directory it becomes the current directory, so the macro can then be run.

    Hope this Helps!

  11. #11
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Ephrata, Washington, USA
    Posts
    683
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Inserting Clipart Etc. (Word97(SR2))

    The macro seems to run fine, but I can't see the pictures. Mine are jpg, and I changed the file type to jpg in the code. I see the placeholders for the code. I checked to be sure Word would view a jpg by inserting one manually, and it viewed fine. What am I missing? If this works, this could be a lifesaver for one of our users. She has been asking for this for quite sometime now.

  12. #12
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    199
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Re: Inserting Clipart Etc. (Word97(SR2))

    Melanie,

    Sorry this is not working exactly the way you would like, but I think I understand your problem as I have just sucessfully done what you wanted.

    I replaced the line with "*.wmf" with one with '*.jpg", which is I suspect exactly what you did.

    When the macro runs it looks only at the Current Directory, which is set when you do File Open and go the the directory you want to use to create the document (NB: not when you goto Insert Picture).

    After making the above change to test your situation this is what I did to test that it worked for jpg's:

    1. In Word I used File Open to navigate to the directory where the jpg's reside. When I found the directory I selected Cancel - this has set the Current Directory to the directory the macro will use.

    2. I then just ran the macro and WOW! all the jpg's came up beautifully, three across the page. (Actually I had never used this macro on jpg's before, and really think it's great. By the way I did not write the macro but picked it up for Clipart from Microsoft about 5 years ago!!)

    I hope you can achieve the same result!

    Good Luck!

  13. #13
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Ephrata, Washington, USA
    Posts
    683
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Inserting Clipart Etc. (Word97(SR2))

    I did exactly what you are talking about. The macro seems to run fine. It creates the tables, and the text, and even creates the squares for the pictures. But, the pictures don't display. I have checked the Options to be sure Word is set to display graphics, and it is. Could this be because I am opening files from across a network? I don't see how. The text/description for each jpg is correct. This is sooooo close! I just know I'm only missing one tiny thing that will let me view the jpgs.

    I have tried double-clicking or right clicking on the image borders and selecting Edit Picture, but when I do, nothing happens. The option is there when I right-click, so I know it thinks it's a picture.

    If I manually insert the picture, using the same path as the macro puts in each cell, the picture inserts fine and I can view the jpg.

  14. #14
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    199
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Re: Inserting Clipart Etc. (Word97(SR2))

    Melanie,

    This is getting out of my depth!

    I have checked the Microsoft Knowledge Base and the following article is there:

    WD97: Clipart Images Display Incorrect Format Picture Options (Q173286)

    http://support.microsoft.com/support/kb/ar...N-AU&SD=gn&FR=0

    It suggests that this is a known problem and the solution is to save as a HTML file and then re-open.

    I can only suggest you check your options in Tools Options View etc., otherwise it may be an incompatibility between WordBasic and the version of Word you are using.

    I am sorry I can't be of more help.

  15. #15
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Ephrata, Washington, USA
    Posts
    683
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Inserting Clipart Etc. (Word97(SR2))

    Thanks anyway. I've been playing with this, and there is something about how the directory is named that affects it. I haven't pinned it down exactly. But, I think if there are underscores in the directory name, the picture won't display. I managed to get two directories to display the pictures. The common thread was that the filenames and directory name were fairly short and didn't contain any characters. I'm not 100% sure this is right, but at least I got SOMETHING to display. I'll post the answer when I'm done so that it might help someone else with this.

    In the meantime, if anyone knows how the file name or directory name affects this code, please let me know. I know absolutely nothing about VB, and I can't really figure this out any other way than just trial and error.

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
  •