Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Opening files with variable names
I'm looking for code to open an excel workbook with a variable name. The file
name should be fairly constant except there will be a revision level on the end of the file name. For example, C:\Excelfile rev.01. Is there some code to open a filename containing a phrase? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Opening files with variable names
Open any module and paste the codes they are read through the comments
Function WorkbookOpen(Mydir As String, WorkBookName As String, VC As String) ' by Ritwik Shukla ' MyDir is path of directory ' My workbbok name is standard name of the excel workbooks ' VC is version control fullpath = Mydir & "\" & WorkBookName & VC & ".xls" ' Your full path Workbooks.Open fullpath End Function Testing This function : Lest say you have 4 file stored in C:\Manyfile folder and names are test1.xls, test2.xls and so on Sub openbookTest() Dim N As Integer ' VC as Integer Dim I As String ' Vc as String For N = 1 To 4 ' You can set this value vy counting files in folder ' visit http://www.ozgrid.com/forum/showthread.php?t=51500 I = N Call WorkbookOpen("C:\Manyfile", "Test", I) ' Calling function Next N End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro for opening files that changes names | Excel Discussion (Misc queries) | |||
Rename files with variable names | Excel Programming | |||
Opening Variable File Names | Excel Programming | |||
excel VBA problem - setting workbook as variable & opening/re-opening | Excel Programming | |||
Opening files from a variable (todays' date) folder name | Excel Programming |