Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using a Variable in the Workbooks.Open code


Hey Ron,

I gave that a shot and I couldn't get it to work. Does the variabl
have to be set as a Range? When I tried it, excel gave me an error o
"inexpected end of statement". I guess the extra " " was throwing i
off

--
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Using a Variable in the Workbooks.Open code

You can use a string also

Sub test2()
Dim Myvar As String
Myvar = "yourworkbookname"
Workbooks.Open Filename:="\\Jelle\shareddocs\" & Myvar & ".xls"
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Phatchef24" wrote in message ...

Hey Ron,

I gave that a shot and I couldn't get it to work. Does the variable
have to be set as a Range? When I tried it, excel gave me an error of
"inexpected end of statement". I guess the extra " " was throwing it
off.


--
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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
vba code to open workbooks Rebecca1 Excel Worksheet Functions 3 March 5th 08 05:15 PM
macro or code to open multiple workbooks Duane Reynolds Excel Discussion (Misc queries) 1 March 14th 06 08:18 AM
Using a Variable in the Workbooks.Open code Phatchef24[_7_] Excel Programming 1 November 3rd 04 09:40 PM
Sharing variable values between open workbooks? Julian Milano[_2_] Excel Programming 0 January 29th 04 01:13 AM
VBA code for looping through open workbooks and worksheets Jamie Martin[_2_] Excel Programming 1 July 24th 03 06:44 PM


All times are GMT +1. The time now is 04:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"