Macro Help please

E

Excel Beginner

I have a Macro set up to save a work sheet as a web page and print to a
printer on a multiple sheet workbook. I have the same work sheet several
times in the workbook named different. Ex: Mon, Tue, Wed. I recorded the
Macro on the Mon sheet and am trying to get it to work for all other sheets.
When i run the Macro it only publishes the Mon sheet even though I have the
Tue work sheet active. Is there a way to have the Macro run on the Active
Sheet only?
 
E

Excel Beginner

ActiveSheet.Unprotect
Range("A1:AM54").Select
ActiveWindow.SmallScroll Down:=-39
With ActiveWorkbook.PublishObjects.Add(xlSourceRange, _
"\\150.192.103.254\data\ASF\Web Products\KGRF_MEF.htm", "MEF(GRF)
00Z", _
"$A$1:$AM$55", xlHtmlStatic, "DAILY_PROD_22690", _
"Gray Army Airfield - Mission Execution Forecast")
.Publish (True)
.AutoRepublish = False
End With
ChDir "\\150.192.103.254\data\ASF\Web Products"
ActiveWindow.SmallScroll Down:=-27
ActiveSheet.PageSetup.PrintArea = "$A$1:$AM$54"
ActiveWindow.SmallScroll Down:=-30
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("D4:F4").Select
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False
End Sub
 
E

Excel Beginner

ActiveSheet.Unprotect
Range("A1:AM54").Select
ActiveWindow.SmallScroll Down:=-39
With ActiveWorkbook.PublishObjects.Add(xlSourceRange, _
"\\150.192.103.254\data\ASF\Web Products\KGRF_MEF.htm", "MEF(GRF)
00Z", _
"$A$1:$AM$55", xlHtmlStatic, "DAILY_PROD_22690", _
"Gray Army Airfield - Mission Execution Forecast")
.Publish (True)
.AutoRepublish = False
End With
ChDir "\\150.192.103.254\data\ASF\Web Products"
ActiveWindow.SmallScroll Down:=-27
ActiveSheet.PageSetup.PrintArea = "$A$1:$AM$54"
ActiveWindow.SmallScroll Down:=-30
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("D4:F4").Select
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False
End Sub
 
J

John C

Two simple questions first. My VBA isn't all that great, but I do have 2
quick questions.
1> In the coding prior to what you have shown, are there any sheet
selections that could be throwing you off? (probably not, but gotta check)
2> Is the macro residing in your Mon(day) sheet? or is it residing where it
properly should, under ThisWorkbook?
 
E

Excel Beginner

I don't think any sheet selections are throwing me off. For the second
question the Macro is residing under ThisWorkbook.
One other thing, it wouldn't be a deal breaker if I have to write a seperate
macro for each named worksheet if after copying one of the worksheets and
renaming it that the macro will work for the copied sheet.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top