Excel VBA Tutor

Excel VBA Tutor

Share

18/05/2023

How to save workbook as a PDF using VBA.

Sub SaveWorkbookAsPDF()
Dim FilePath As String
Dim FileName As String

' Set the file path and name for the PDF file
FilePath = "C:\Your\Desired\Path\" ' Specify the desired file path
FileName = "YourFileName.pdf" ' Specify the desired file name

' Save the workbook as a PDF file
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=FilePath & FileName, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False

' Display a message when the PDF file is saved
MsgBox "Workbook saved as PDF file: " & FilePath & FileName, vbInformation
End Sub

10/04/2018

To check whether a number is a palindrome or not first we reverse it and then compare the number obtained with the original number, if both are same then the number is palindrome otherwise not. Palindrome string program.Like 16461

Below is the program for your reference.

Sub Check_palindrome()
Dim ss As String
ss = Val(Range("a1"))
For i = Len(ss) To 1 Step -1
mm = mm & Mid(ss, i, 1)
Next
If ss = mm Then
MsgBox "No is palindrome"
Else
MsgBox "No is not palindrome"
End If
End Sub

Photos 27/01/2018

Excel Table tutorial.

Want your school to be the top-listed School/college in Bangalore?
Click here to claim your Sponsored Listing.

Category

Telephone

Address


Bangalore
560066