Automatic printing Excel sheet report

abeed

Board Regular
Joined
Nov 19, 2005
Messages
79
I have an excel workbook with 2 sheets. I am exprting data from MS A ccess in shhet1 and then automatically generating an excel report in sheet2. I want to print the sheet2 report automatically at the same time when I export the data from Access to Excel. I mean If I export a query data from Access to sheet1 it will generate the report in sheet2 and then will automatically print it in my set up printer. I tried to write a VBA code in
my workbook code.
private sub workbook_open()
worksheets(2).printout
end sub
When I export it does not automatically prin the report in sheet2. But when I run the VBA code itself from code Excel view, its printing. But I need it to be automatic when I export from Access.

Thanks
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Not sure if this will work with your code but might help.

Print Sheet()
Application.ScreenUpdating = False
Sheets("Sheet2").Select
With Sheets("Sheet2")
.Visible = True
.PrintOut Copies:=1, Collate:=True
.Visible = xlVeryHidden
End With
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,226,287
Messages
6,190,067
Members
453,592
Latest member
bcexcel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top