Consulting

Page 2 of 2 FirstFirst 1 2
Results 21 to 28 of 28

Thread: Modify Macro which Batch Insert Photos to also include caption

  1. #21
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    It would have been helpful if you specified all of your requirements up front. I'm really not interested in being fed a problem in piecemeal fashion. I imagine the other contributors here have much the same attitude. Indeed, instead of hijacking an existing thread, you should start a new thread. Please do so - with the full specifications of your requirements, including whatever code you are now using and details of what aspects you're having trouble with.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  2. #22
    VBAX Regular
    Joined
    Nov 2012
    Posts
    12
    Location
    Sorry,

  3. #23
    Hi Talis,

    Upon inserting multiple images with captions, I would like to automatically resize the images to make them fit into the page (1 image per page) with caption underneath. Could you shed some lights on how to do this? many thanks!!

    Bing

    Quote Originally Posted by Talis View Post
    Change the line:
    Set oTbl = Selection.Tables.Add(Selection.Range, 1, 2)
    to:
    Set oTbl = Selection.Tables.Add(Selection.Range, 1, 4)
    After the line:
    Documents.Add
    add:
    ActiveDocument.PageSetup.Orientation = wdOrientLandscape
    If you want to set the margins as well then you could record a macro, trim it and add these lines instead of the above line.

    BTW this is a nice macro. Thanks for pointing it out and thanks to Greg.

  4. #24
    Banned VBAX Newbie
    Joined
    Dec 2017
    Posts
    3
    Location
    Quote Originally Posted by macropod View Post
    For the fullname (ie including the path) you could use:
    oILS.Range.InsertCaption Label:="Picture", TitleAutoText:="", Title:=vrtSelectedItem, _
    Position:=wdCaptionPositionBelow, ExcludeLabel:=0

    For the filename without the path you could use:
    oILS.Range.InsertCaption Label:="Picture", TitleAutoText:="", _
    Title:=Split(vrtSelectedItem, "\")(UBound(Split(vrtSelectedItem, "\"))), _
    Position:=wdCaptionPositionBelow, ExcludeLabel:=0

    First of all NB here so if I am not using the proper format, please forgive me!

    I love this macro and will use it many times I am sure, but was wondering if you might be so kind as to help me to tweak it just slightly.

    When I ran this macro the caption reads as follows: "Picture 1(imageName)", As an example, my first image reads: "Picture 1001". I would like to remove the "Picture 1" part and replace that with "#". I have figured out how to remove the word picture but not the sequential numbers. My filenames are the numbers in a 001, 002, etc format so it is redundant to have Picture 1 and so on there.

    Also how can I pull other info from the image file such as date taken, image size, etc?

    Lastly, Is there a place for us beginners to learn some of these procedures and syntax. I believe I saw a link somewhere in this thread but can't remember where!

    Thank you in advance!

  5. #25
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    For what you described, you could use something like:
    oILS.Range.InsertAfter Chr(11) & "# " & Split(vrtSelectedItem, "\")(UBound(Split(vrtSelectedItem, "\")))
    However, by not using Word's captioning system, it will be more work to cross-reference the pics later on.

    As for getting the date taken, image size, etc., that would require considerably more work.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  6. #26
    Banned VBAX Newbie
    Joined
    Dec 2017
    Posts
    3
    Location
    thank you!

  7. #27
    Banned VBAX Newbie
    Joined
    Dec 2017
    Posts
    3
    Location
    ok so could I add a space between the sequential numbers so that it separates it from the file name or even better code that would kick it down a line?

  8. #28
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Please make up your mind what you want. I don't enjoy wasting time developing solutions only to be told something different is wanted. Please also understand that Word's captioning requires the 'Picture' designation for cross-referencing, too.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Posting Permissions

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