Answered step by step
Verified Expert Solution
Link Copied!

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:

image text in transcribed

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 subroutine

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 11g SQL

Authors: Jason Price

1st Edition

0071498508, 978-0071498500

More Books

Students also viewed these Databases questions