

From here you can go on with your project. Below will the syntax from the Workbooks. With VBA in Excel, you can easily clear one or more Excel files by specific their location. Wb.Sheets(1).Range("A4:P" & lr).Copy sh.Range("A4") This is the minimum you need to open your file. In Excel VBA, thee can use Workbooks.Open method to open an Excell file, somewhere you need to specify the file path of the Excel workbooks that to wants to open. Just declare de API header and you can 'call' a file directly to open it in associated application. Lr = wb.Sheets(1).Cells.Find("*",, xlFormulas, xlPart, xlByRows, xlPrevious).Offset(-3, 0).Row If Application.CountA(sh.Rows(4)) = 0 Then You can use the ShellExecute VB function. ''lr = wb.Sheets(1).Cells.Find("*",, xlFormulas, xlPart, xlByRows, xlPrevious).Row ' goes to bottom of data Set sh = ThisWorkbook.Sheets(1) 'Edit sheet name ' Brings data (Tables)from workbooks that are open places the data in one large table in a workbook.ĭim sh As Worksheet, wb As Workbook, lr As Long. Include only files where first 6 letters of filename are 'custom.".Only problem isfew staff members saves files in xls format, few in xlsm, and few in xlsx Limited point is I just want macro to open my file say myfile.xlsx, myfile.
#Vba open any file code
I assume it will involve changing the line code which now reads So, I dont have to choose file with Application.GetOpenFilename. This is desired because I often have many other open workbooks with filenames that do not begin with characters "Custom" and I do not want to collect any data from these. The code would be added to the macro below. I am a macro novice trying to add macro code that will find workbooks where first 6 characters in the file name are "Custom" and any characters after that are allowable.
