Hi all,

I need help tweaking one of my simple macros. I would like to open a
file after I enter a value into a input box. I have files stored in a
specific folder and each one is named like "year_sequence_number", ie:
2011_001. I need a macro which would open a file based on a value I
enter. For example: I enter the value 123 and I get the file 2011_123
opened.

First I wrote this using my basic knowledge:

------------------------------------------------------------------------------------------------
Sub OpenFile()
Dim File As Integer

File = InputBox("Vnesi nalog")

If File = 001 Then

Workbooks.Open Filename:="C:\Users\user\Desktop\2011_001.xlsx"

Else

Exit Sub

End If


End Sub
------------------------------------------------------------------------------------------------

Now is it possible and how to modify this so I wouldn't have to copy
and paste this a thousand times:)
And if possible, I would only like to enter the last three digits as a
value: just 001 and not the full name 2011_001.

Thank you and best regards,
seba

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

Reply via email to