LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Wildcards In VBA Macros

Tony,

Rather than use wild cards, when you open a file (and before you do anything
else) read the files name into a string variable and then navigate using that
variable. This sould pick up any sequential digits and make your life much
easier.

"TONYC" wrote:


I have devised a long macro (only a small part shown below) which
extractes data from a file called 'Risk Question.xls.' when completed
and returned to me via Microsoft outlook. However, since its creation
I have aquired Windows XP, which I understand adds a sequential digit
after the file name when opened (ie Risk Question1.xls), when opening
several files woith the same name one after the other. (Even thought I
ensure I close the active file beofre openeing the new file.)

My quesion is could I use a wild card (eg 'Risk Question[b]*.xls') to
extract data from these files. I havent changed the macro as its very
long and wanted advise first.

Name
Windows("Risk Question.xls").Activate
Range("C5:E5").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Risk Register.xls").Activate
Range("C" & nextlineno).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False


Regards

Tony


--
TONYC
------------------------------------------------------------------------
TONYC's Profile: http://www.excelforum.com/member.php...o&userid=12468
View this thread: http://www.excelforum.com/showthread...hreadid=261967


 
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
How can I use wildcards in IF statements and Macros AlanF Excel Discussion (Misc queries) 2 November 22nd 09 11:08 PM
Wildcards and if Arlene Excel Worksheet Functions 3 June 21st 07 12:05 AM
use of wildcards italiavb Excel Worksheet Functions 5 July 14th 06 05:48 AM
Use wildcards furia Excel Discussion (Misc queries) 0 November 16th 05 06:23 PM
wildcards in vba shellshock Excel Discussion (Misc queries) 3 July 21st 05 07:37 PM


All times are GMT +1. The time now is 12:25 PM.

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

About Us

"It's about Microsoft Excel"