템플릿을 열고 파일 이름을 묻고 파일을 저장하는 간단한 작은 Excel 매크로가 있습니다. Microsoft VBA 창에서 문제없이 실행되지만 Excel에서 바로 가기 키를 사용하면 파일이 열리지 만 입력 상자는 표시되지 않습니다.매크로가 바로 가기 키에서 실행될 때 입력 상자가 나타나지 않습니다.
Sub NewCommentSheet()
'
' NewCommentSheet Macro
' Opens the Comments and Recheck template. A dialog box asks for the data module name,
' which is then used for the filename of the new comment sheet.
'
' Keyboard Shortcut: Ctrl+Shift+N
'
'Opens the file
Workbooks.Open Filename:= _
"C:\Users\Kelly.Keck\Documents\Projects\SBIR\QA Notes\Comments and Recheck Template.xlsx"
'Defines variables. moduleName comes from the input box. newFileName uses moduleName _
to create a filename: "Comments for [moduleName].xslx"
Dim moduleName As String
Dim newFileName As String
'Asks the user for the data module name--default is set as the common portion of _
the filename.
moduleName = Application.InputBox(Prompt:="Enter the name of the data module.", _
Title:="Data Module Title", Default:="DMTitle-")
'Checks to see if input was canceled. If canceled, ends the macro to avoid saving with an incorrect filename.
If moduleName = "False" Then End
'Saves file with the new name.
newFileName = "Comments for " & moduleName & ".xslx"
ActiveWorkbook.SaveAs Filename:=newFileName
End Sub
전에
DoEvents
추가 예는 잘 알려진 문제 (내가 그렇게 희망)입니다. 왜 이런 일이 일어날 지 알려주세요 :) –BTW 내가 "그렇게되기를 바란다"는 말은 많은 사람들이 그 한계를 알고 있기를 희망한다고 ... –