Project 2 - Create a report using PowerQuery, Macro VBA, List Functions and Data Validation functions for Data Reporting of Supply Chain Management companies
1)VBA code to convert data into PDF
sub printselectiontopdf()
'SUBROUTINE:
Printselectiontopdf
'DESCRIPTION: print your currently selected range to a PDF
Dim thisrng as range
Dim strfile as string
Dim MYFILE AS VARIENT
if selection.count=1 then set thisrng= application.inputbox("select a range","GET RANGE", type:=8)
else
set thisrng = selection
end if
'promt for save location strfile="selection"&"_"_& format(now(),
"yyyymmdd_hhmmss")_ & ".pdf"
strfile=thisworkbook.path&"\"& strfile
myfile=
application.getsaveasfilename_
(initialfilename:=strfile,_ filefilter:="PDF files*.PDF),*.PDF",_
Title:="select folder and file name to save as PDF")
if MYFILE<>"FALSE" THEN 'save as PDF
Thisrng.exportasfixedformat
type:=x1typePDF,filename:=_
mylife.
quality:=x1qualitystandard,includedocproperties:=true,_
ignoreprintareas:=false,
openafterpublish:=true
else
msgbox"no file selected.PDF will not be saved",
vvOKOnly,"no file selected"
end if
end sub
2) Check Spelling mistakes in the workbook using VBA Code
sub checkspelling(0
dim sp as range
for each sp in activesheet.usedrange
if not application.checkspelling(word:=sp.text) then
sp.interior.colour=vbred
end if
next sp
end sub
file link unable to add large file