Msgbox Search function

Closed
Elton Law - Apr 5, 2009 at 09:46 AM
eltonlaw Posts 7 Registration date Saturday April 4, 2009 Status Member Last seen April 8, 2009 - Apr 6, 2009 at 03:55 AM
Hello expert,

I have to open a lot of windows (files) at the same time in Excel every day.
All are different names with date being shown at the end ... e.g. MV090403, MV090401, CV090402 .....

The fact is that my system will automatically generate above files with latest date at the end.

But my written marco cannot link or map to the file with different file name every day. Usually a marco can only preset to open or action on a fixed file name .....

Now I do encounter a variable file name every day ......

I want to create a marco which would can pop up a window (Message box) to ask me which file I want to open and then run the marco on that file as usual .... that can help me to select or input the latest system generated file .....

If possible, while debug the scripts in marco, it can automatically activate the window which I have type in the message box

Say I type BMV090402 in the message box ... it can automatically change the original scripts to the file name I type ...
e.g
Windows("BMV090402").Activate

Look like it is quite complicated.
Hope miracle can come ....
Thanks so much
Related:

4 responses

1700only4ade Posts 1 Registration date Saturday April 4, 2009 Status Member Last seen April 5, 2009
Apr 5, 2009 at 10:07 AM
I need infn on it mentenance
0
eltonlaw Posts 7 Registration date Saturday April 4, 2009 Status Member Last seen April 8, 2009 8
Apr 6, 2009 at 01:52 AM
Hi Expert ...

Say for an example ...

(In the past) ............

ChDir "H:\bony\MM"
Workbooks.Open Filename:="H:\bony\MM\MV_RAWDATA.xls"
Application.Goto Reference:="R2C1"
ActiveCell.Range("A1:H62").Select
Selection.ClearContents
Application.Goto Reference:="R2C1"
Windows("M040409").Activate
.....................
.....................

Ususally, the script must clearly mention the file name ..... then marco runs on and on ...

But now I come across with the source file changing every day (with date mentioned at the end) ....
System would come up with a file as MV_040409.xls

Can we customize to use Message Box (MSgBox) to type the file name (have been opened already), then run the marco on that particular file ?

Thanks
Elton



0
eltonlaw Posts 7 Registration date Saturday April 4, 2009 Status Member Last seen April 8, 2009 8
Apr 6, 2009 at 03:44 AM
Hi,
I think it should be inputbox rather than msgbox.

I have opened a list of files below ...

MV040409
MC030409
RE020409
CV040409

Under Menu_Window, I can select above files as I like.

Then, while debugging the scripts ... can I set an Inputbox and then choose the files (windows) I want that marco to run on please ? Or just activate that file is fine ....

That is the file name I input in the InputBox.

Hope fellow Excel genuis can help ....

Thanks
Elton
0
eltonlaw Posts 7 Registration date Saturday April 4, 2009 Status Member Last seen April 8, 2009 8
Apr 6, 2009 at 03:55 AM
Hi all.....

Someone taught me ....


Sub test02()

UserValue = InputBox("Which File to Use for revaluation?")
Windows(UserValue).Activate

End Sub


Look like it is fine...
So Solved ....

Sorry to pester
0