- Katılım
- 7 Şubat 2024
- Mesajlar
- 14
- Excel Vers. ve Dili
- Microsoft Office Professional Plus 2016
merhaba kolay gelsin. elimde bir adet vba kodu var. ben bu kodla world toplu halde resim yüklüyorum. kodun normal yükelemeden farklı resimler yüklenirken adlarla beraber geliyor. fakat adlar gelirken hem uzantı hemde dosya yoluyla bereber geliyor.
var olan:
E:\dsdsdsdsdsdd\sdsdsdsdds\ddsdsdssdds\abc.jpg
istenilen:
abc
ctrl+h basarak karakterileri değiştirebiliyorum fakat bu işlemi çok fazla tekrar ediyorum. kodu düzenleyi direk adıyla beraber gelmesini sağlaya bilirmiyiz.
-----------------------------------------------------------------------------------------------------
Sub PicWithCaption()
Dim xFileDialog As FileDialog
Dim xPath, xFile As Variant
On Error Resume Next
Set xFileDialog = Application.FileDialog(msoFileDialogFolderPicker)
If xFileDialog.Show = -1 Then
xPath = xFileDialog.SelectedItems.Item(1)
If xPath <> "" Then
xFile = Dir(xPath & "\.")
Do While xFile <> ""
If UCase(Right(xFile, 3)) = "PNG" Or _
UCase(Right(xFile, 3)) = "TIF" Or _
UCase(Right(xFile, 3)) = "JPG" Or _
UCase(Right(xFile, 3)) = "GIF" Or _
UCase(Right(xFile, 3)) = "BMP" Then
With Selection
.InlineShapes.AddPicture xPath & "\" & xFile, False, True
.InsertAfter vbCrLf
.MoveDown wdLine
.Text = xPath & "\" & xFile & Chr(10)
.MoveDown wdLine
End With
End If
xFile = Dir()
Loop
End If
End If
End Sub
var olan:
E:\dsdsdsdsdsdd\sdsdsdsdds\ddsdsdssdds\abc.jpg
istenilen:
abc
ctrl+h basarak karakterileri değiştirebiliyorum fakat bu işlemi çok fazla tekrar ediyorum. kodu düzenleyi direk adıyla beraber gelmesini sağlaya bilirmiyiz.
-----------------------------------------------------------------------------------------------------
Sub PicWithCaption()
Dim xFileDialog As FileDialog
Dim xPath, xFile As Variant
On Error Resume Next
Set xFileDialog = Application.FileDialog(msoFileDialogFolderPicker)
If xFileDialog.Show = -1 Then
xPath = xFileDialog.SelectedItems.Item(1)
If xPath <> "" Then
xFile = Dir(xPath & "\.")
Do While xFile <> ""
If UCase(Right(xFile, 3)) = "PNG" Or _
UCase(Right(xFile, 3)) = "TIF" Or _
UCase(Right(xFile, 3)) = "JPG" Or _
UCase(Right(xFile, 3)) = "GIF" Or _
UCase(Right(xFile, 3)) = "BMP" Then
With Selection
.InlineShapes.AddPicture xPath & "\" & xFile, False, True
.InsertAfter vbCrLf
.MoveDown wdLine
.Text = xPath & "\" & xFile & Chr(10)
.MoveDown wdLine
End With
End If
xFile = Dir()
Loop
End If
End If
End Sub