I have a debugging problem for homework in class and I made the changes I saw that were necessary but I am getting an error. It says method or data member not found
for my code that is shtCurrent.name
that is in the message box.
I have researched as much as possible but I cannot find an answer. Can anyone help me out?
Thank you.
Public Sub PrintWorksheets1()
'declare variables and assign address to object variable
Dim strPrint As String, wkbHours As Workbook, shtCurrent As Worksheets
Set wkbHours = Application.Workbooks("auco6215_HW10_Ex9.xlsm")
wkbHours.Activate
'ask user if he or she wants to print the worksheet
For Each shtCurrent In wkbHours.Worksheets
strPrint = _
MsgBox(prompt:="Print " & shtCurrent.Name & "?", Buttons:=vbYesNo + vbExclamation)
If strPrint = vbYes Then 'if user wants to print
shtCurrent.PrintPreview
End If
Next shtCurrent
End Sub
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…