Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I was wondering if it was possible to use a variable when using the Ope workbook code. I already have the file name that I need declared as variable in my code already and now all I need to do is place that nam at the end of this code. Workbooks.Ope Filename:="\\C:\myfiles\SOMEFILENAMETHATCHANGESeac hmonth.xls" Is it possible to have excel do this automatically or am I stuck wit having to go in to VBA and edit the code each month -- Phatchef2 ----------------------------------------------------------------------- Phatchef24's Profile: http://www.excelforum.com/member.php...fo&userid=1093 View this thread: http://www.excelforum.com/showthread.php?threadid=27504 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try something like this
Sub test() Dim Myvar As Range Set Myvar = Sheets("sheet1").Range("A1") Workbooks.Open Filename:="\\Jelle\shareddocs\" & Myvar & ".xls" End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Phatchef24" wrote in message ... I was wondering if it was possible to use a variable when using the Open workbook code. I already have the file name that I need declared as a variable in my code already and now all I need to do is place that name at the end of this code. Workbooks.Open Filename:="\\C:\myfiles\SOMEFILENAMETHATCHANGESeac hmonth.xls" Is it possible to have excel do this automatically or am I stuck with having to go in to VBA and edit the code each month? -- Phatchef24 ------------------------------------------------------------------------ Phatchef24's Profile: http://www.excelforum.com/member.php...o&userid=10938 View this thread: http://www.excelforum.com/showthread...hreadid=275048 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
vba code to open workbooks | Excel Worksheet Functions | |||
macro or code to open multiple workbooks | Excel Discussion (Misc queries) | |||
Visual Basic code available for all open workbooks | Excel Worksheet Functions | |||
Sharing variable values between open workbooks? | Excel Programming | |||
VBA code for looping through open workbooks and worksheets | Excel Programming |