اذهب الي المحتوي
أوفيسنا

المطلوب تغيير اسم حفظ الملف PDF حسب تغيير محتوى خليه F3


إذهب إلى أفضل إجابة Solved by حسونة حسين,

الردود الموصى بها

جرب هدا 

Dim sFile As String
sFile = Range("F3").Value
sNewFilePath = ThisWorkbook.Path & "\"

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
        Filename:=sNewFilePath & sFile & ".pdf", _
        Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False

مجرد تخمين ربما يفيدك

Sub General()
Dim LatR As Long:
Dim sFile As String
Set WS = ActiveSheet:     sFile = [F3].Value
 
LatR = Range("a:a").Find("*", LookIn:=xlValues, SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row

WS.PageSetup.PrintArea = Range("A2:AF" & LatR).Rows.SpecialCells(xlCellTypeVisible).Address
 WS.VPageBreaks(1).DragOff Direction:=xlToRight, RegionIndex:=1
sNewFilePath = ThisWorkbook.Path & "\"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
        Filename:=sNewFilePath & sFile & ".pdf", _
        Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False

Sheets("النتيجة2").Select

End Sub

 

  • Like 1
رابط هذا التعليق
شارك

ربما لو قمت بارفاق الملف سوف تكون الامور اوضح 

تفضل جرب

Sub General()
Dim LatR As Long:
Dim sFile As String
Set WS = ActiveSheet:     sFile = [F3].Value
On Error Resume Next
LatR = Range("A:A").Find("*", LookIn:=xlValues, SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
With WS

.PageSetup.PrintArea = Range("A2:AF" & LatR).Rows.SpecialCells(xlCellTypeVisible).Address
.VPageBreaks(1).DragOff Direction:=xlToRight, RegionIndex:=1
sNewFilePath = ThisWorkbook.Path & "\"
.ExportAsFixedFormat Type:=xlTypePDF, _
        Filename:=sNewFilePath & sFile & ".pdf", _
        Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End With
Sheets("النتيجة2").Select

End Sub

 

 

 

TEST PDF.xlsb

تم تعديل بواسطه محمد هشام.
  • Like 1
رابط هذا التعليق
شارك

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information