✔ 最佳答案
I assume you know how to create & program buttons & here are your answers:
1) Workbooks.Open Filename:="d:/aaa/aaa/xxx.xls"
2) Assume your print area is A1:D7
ActiveSheet.PageSetup.PrintArea = "$A$1:$D$7"
ActiveWindow.SelectedSheets.PrintOut Copies:=1
Note: the following line allows you to cancel the print area
ActiveSheet.PageSetup.PrintArea = ""
3) (not clear about your question).....this code will delete the first picture in your curren worksheet, import a new picture and then move it to the same location
Dim Lft as long, Tp as long
ActiveSheet.Shapes(ActiveSheet.Shapes.count).select
Lft = Selection.ShapeRange.left
Tp = Selection.ShapeRange.top
Selection.Delete
ActiveSheet.Pictures.Insert("d:\abc.jpg").Select
Selection.ShapeRange.left = Lft
Selection.ShapeRange.top = Tp
4) Use auto_open to run commands when excel is opened.
Sub Auto_Open()
If "123" = InputBox("Pls input password", "Login") Then
sheet("sheetx").select
else
activeworkbook.Close
End If
End Sub
note: you should add similar code to the protected worksheet and will ask fro p/w everytime it is being selected
Calvin Lee
2009-01-29 00:38:49 補充:
4) missed a 's' in my example...
Sub Auto_Open()
If "123" = InputBox("Pls input password", "Login") Then
sheets("sheetx").select
else
activeworkbook.Close
End If
End Sub