Hi,
In excel by using lookup functionality we are generating some records in a table by selecting the table or print area using macro auto script i am printing them as pdf's in my computer harddisk, but my requirement is to print as image instead of pdf. I am okay with any format of image preferably jpeg or png. Here is my script please help me with the code which generate images and auto save in my computer particular folder.
Sheet Name: Data
[TABLE="width: 384"]
<colgroup><col width="64" span="6" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]S.No[/TD]
[TD="class: xl65, width: 64"]id[/TD]
[TD="class: xl65, width: 64"]name[/TD]
[TD="class: xl65, width: 64"]website[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]ABC[/TD]
[TD]Good MBA Colleges[/TD]
[TD]Top[/TD]
[TD]Test1[/TD]
[TD="align: right"]480000[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]ABC[/TD]
[TD="class: xl66"]MBA Colleges[/TD]
[TD]Best[/TD]
[TD]Test2[/TD]
[TD="align: right"]480000[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]ABC[/TD]
[TD]Top Colleges[/TD]
[TD]Top[/TD]
[TD]Test3[/TD]
[TD="align: right"]480000[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]ABC[/TD]
[TD]Required colleges[/TD]
[TD]Top[/TD]
[TD]Test4[/TD]
[TD="align: right"]480000[/TD]
[/TR]
</tbody>[/TABLE]
Sheet Name: Report
[TABLE="width: 474"]
<colgroup><col span="3"><col><col span="2"></colgroup><tbody>[TR]
[TD]Lookup Table:[/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Service[/TD]
[TD]ABC[/TD]
[TD]Dicounted Colleges[/TD]
[TD]Inputs[/TD]
[TD]Scholarship[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]ABC[/TD]
[TD]Good MBA Colleges[/TD]
[TD]Top[/TD]
[TD]Test1[/TD]
[TD="align: right"]480000[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]ABC[/TD]
[TD]Top Colleges[/TD]
[TD]Best[/TD]
[TD]Test2[/TD]
[TD="align: right"]480000[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]ABC[/TD]
[TD]Top Colleges[/TD]
[TD]Top[/TD]
[TD]Test3[/TD]
[TD="align: right"]480000[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]ABC[/TD]
[TD]Required colleges[/TD]
[TD]Top[/TD]
[TD]Test4[/TD]
[TD="align: right"]480000[/TD]
[/TR]
</tbody>[/TABLE]
Requirement: Print this table as image instead of pdf by using macro script
Script for printing as pdf
Please help me with script which generate images and auto save in local hard-disk.
In excel by using lookup functionality we are generating some records in a table by selecting the table or print area using macro auto script i am printing them as pdf's in my computer harddisk, but my requirement is to print as image instead of pdf. I am okay with any format of image preferably jpeg or png. Here is my script please help me with the code which generate images and auto save in my computer particular folder.
Sheet Name: Data
[TABLE="width: 384"]
<colgroup><col width="64" span="6" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]S.No[/TD]
[TD="class: xl65, width: 64"]id[/TD]
[TD="class: xl65, width: 64"]name[/TD]
[TD="class: xl65, width: 64"]website[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]ABC[/TD]
[TD]Good MBA Colleges[/TD]
[TD]Top[/TD]
[TD]Test1[/TD]
[TD="align: right"]480000[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]ABC[/TD]
[TD="class: xl66"]MBA Colleges[/TD]
[TD]Best[/TD]
[TD]Test2[/TD]
[TD="align: right"]480000[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]ABC[/TD]
[TD]Top Colleges[/TD]
[TD]Top[/TD]
[TD]Test3[/TD]
[TD="align: right"]480000[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]ABC[/TD]
[TD]Required colleges[/TD]
[TD]Top[/TD]
[TD]Test4[/TD]
[TD="align: right"]480000[/TD]
[/TR]
</tbody>[/TABLE]
Sheet Name: Report
[TABLE="width: 474"]
<colgroup><col span="3"><col><col span="2"></colgroup><tbody>[TR]
[TD]Lookup Table:[/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Service[/TD]
[TD]ABC[/TD]
[TD]Dicounted Colleges[/TD]
[TD]Inputs[/TD]
[TD]Scholarship[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]ABC[/TD]
[TD]Good MBA Colleges[/TD]
[TD]Top[/TD]
[TD]Test1[/TD]
[TD="align: right"]480000[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]ABC[/TD]
[TD]Top Colleges[/TD]
[TD]Best[/TD]
[TD]Test2[/TD]
[TD="align: right"]480000[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]ABC[/TD]
[TD]Top Colleges[/TD]
[TD]Top[/TD]
[TD]Test3[/TD]
[TD="align: right"]480000[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]ABC[/TD]
[TD]Required colleges[/TD]
[TD]Top[/TD]
[TD]Test4[/TD]
[TD="align: right"]480000[/TD]
[/TR]
</tbody>[/TABLE]
Requirement: Print this table as image instead of pdf by using macro script
Script for printing as pdf
Code:
Sub PrintAll()
RowCount = Worksheets("Data").Cells(Rows.Count, 1).End(xlUp).Row - 15
Worksheets("Report").Select
For i = 1 To RowCount
Range("B1").Value = i
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:="D:\CoursesMBA LOCAL\Ideas Vendors Business\Excel Worksheet\Test FOlder33" & Range("B1").Value & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Next i
End Sub
Last edited by a moderator: