Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 03-07-2022, 06:54 PM
mathemagician44 mathemagician44 is offline Using portions of a filename for a caption. Windows 11 Using portions of a filename for a caption. Office 2019
Novice
Using portions of a filename for a caption.
 
Join Date: Jan 2022
Posts: 7
mathemagician44 is on a distinguished road
Default

I have tried this and 58 different variations trying to figure this out. Thus far, I have just been going back and deleting the beginning number of the caption after the macro has ran. But this is tedious for numerous photos multiple times per week.

Trying to incorporate what you said to my program, I now have below, but the "isnumeric" is not working

Code:
'Get the Image name for the Caption
        StrTxt = Split(.SelectedItems(j), "")(UBound(Split(.SelectedItems(j), "")))
        StrTxt = "." & Split(StrTxt, ".JPG")(0)
        Dim iPos As Integer
        Dim sCaption As String
        If IsNumeric(Left(StrTxt, 1)) = True Then
        iPos = InStr(1, StrTxt, " ")
        sCaption = Mid(StrTxt, iPos + 1)
        Else
        sCaption = StrTxt
        End If
        'Insert the Caption on the row below the picture
        With oTbl.Cell(r + 1, c).Range
        .InsertBefore vbCr
        .Characters.First.InsertCaption _
        Label:="Photograph", Title:=StrTxt, _
        Position:=wdCaptionPositionBelow, ExcludeLabel:=False
        .Characters.First = vbNullString
        .Characters.Last.Previous = vbNullString
        End With

Last edited by macropod; 03-07-2022 at 07:37 PM. Reason: Added code tags
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to uninstall portions of Office Pro 2016 Moondoggy Office 1 07-10-2020 04:10 AM
filename field not displaying correct filename when that name starts with # plrsmith Word 1 07-06-2018 03:10 AM
Using portions of a filename for a caption. Filename UnlimitedPower Word VBA 1 08-19-2016 12:22 AM
Showing or hiding portions of contract based on selected services. BlackrazorNZ Word 1 05-30-2014 05:43 AM
Error! Filename not Specified mark.lacey Outlook 0 10-12-2011 03:02 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:48 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft