Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need help writing VBA code for the following: 2. Inside the same file, copy the code below into a new module named Task2: Sub OpenAFile()
Need help writing VBA code for the following:
2. Inside the same file, copy the code below into a new module named Task2: Sub OpenAFile() Opens a file from the folder this workbook is saved in Dim strFileName As String strFileName = "sample.xlsx" Turn off the default Excel messages Application.DisplayAlerts = False workbooks.Open Filename : =ThisWorkbook.Path & "\" & strFileName 'Turn on the alerts again Application.DisplayAlerts = True End Sub Try running the code. Since you don't have the sample file in your folder, it displays a runtime error. or etle un e ound File Error The file called sample.xlsx cannot be found or another error occurred. Make sure to include the custom title and the vbCritical button style. Create a worksheet named FileCheck and place a button that runs the subroutineStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started