MS Office Forum / Excel / New Users / December 2006
Tidying up VB...
|
|
Thread rating:  |
MarkHear1 - 08 Dec 2006 11:56 GMT Hi All,
I have written a quite simple VB script, and have got a section that I would like to "tidy up" If anybody could offer any suggestions they would be greatly appreciated. The section of script is below: Application.Wait Now + TimeValue("00:00:5") SendKeys "{Tab}", True SendKeys "{tab}", True SendKeys "{tab}", True SendKeys "{Tab}", True SendKeys "{tab}", True SendKeys "{tab}", True SendKeys "{Tab}", True SendKeys "{tab}", True SendKeys "{tab}", True SendKeys "{tab}", True SendKeys "{tab}", True SendKeys "{Tab}", True SendKeys "{tab}", True SendKeys "{tab}", True SendKeys "{Tab}", True SendKeys "{tab}", True SendKeys "{ENTER}"
Many Thanks, Mark
Nick Hodge - 08 Dec 2006 12:03 GMT It would help to know what all those tabs are there to achieve
 Signature HTH Nick Hodge Microsoft MVP - Excel Southampton, England nick_hodgeTAKETHISOUT@zen.co.ukANDTHIS www.nickhodge.co.uk
> Hi All, > [quoted text clipped - 23 lines] > Many Thanks, > Mark MarkHear1 - 08 Dec 2006 12:10 GMT They are there to tab through options on a website on IE I was wondering if there was maybe a loop that i could use?
Thanks, Mark
> It would help to know what all those tabs are there to achieve > [quoted text clipped - 5 lines] > nick_hodgeTAKETHISOUT@zen.co.ukANDTHIS > www.nickhodge.co.uk Nick Hodge - 08 Dec 2006 12:22 GMT Mark
Ah, right, well you could use a for x = 1 to 10 type loop, but I doubt it will be significantly quicker
 Signature HTH Nick Hodge Microsoft MVP - Excel Southampton, England nick_hodgeTAKETHISOUT@zen.co.ukANDTHIS www.nickhodge.co.uk
> They are there to tab through options on a website on IE > I was wondering if there was maybe a loop that i could use? [quoted text clipped - 11 lines] >> nick_hodgeTAKETHISOUT@zen.co.ukANDTHIS >> www.nickhodge.co.uk MarkHear1 - 08 Dec 2006 12:27 GMT Nick,
Ok then, thank you for your help. I will look into this option, do you know of anywhere that I can read up on this type of loop?
Thank you, Mark
> Mark > [quoted text clipped - 24 lines] > >> nick_hodgeTAKETHISOUT@zen.co.ukANDTHIS > >> www.nickhodge.co.uk Bob Phillips - 08 Dec 2006 14:38 GMT It won't be quicker Mark, it will be slower, and will be less clear IMO. I wouldn't bother personally.
 Signature --- HTH
Bob
(change the xxxx to gmail if mailing direct)
> Nick, > [quoted text clipped - 33 lines] >> >> nick_hodgeTAKETHISOUT@zen.co.ukANDTHIS >> >> www.nickhodge.co.uk Jim Cone - 08 Dec 2006 12:41 GMT Another way... SendKeys "{Tab 16}", True
 Signature Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware
"MarkHear1" <markhearsum@gmail.com> wrote in message Hi All, I have written a quite simple VB script, and have got a section that I would like to "tidy up" If anybody could offer any suggestions they would be greatly appreciated. The section of script is below: Application.Wait Now + TimeValue("00:00:5") SendKeys "{Tab}", True SendKeys "{tab}", True SendKeys "{tab}", True SendKeys "{Tab}", True SendKeys "{tab}", True SendKeys "{tab}", True SendKeys "{Tab}", True SendKeys "{tab}", True SendKeys "{tab}", True SendKeys "{tab}", True SendKeys "{tab}", True SendKeys "{Tab}", True SendKeys "{tab}", True SendKeys "{tab}", True SendKeys "{Tab}", True SendKeys "{tab}", True SendKeys "{ENTER}" Many Thanks, Mark
MarkHear1 - 08 Dec 2006 12:55 GMT Jim,
Thank you very much for this. While i have your attention (if i still do) could i please pick your brains with another VB query? :-)
Many Thanks, Mark
> Another way... > SendKeys "{Tab 16}", True [quoted text clipped - 30 lines] > Many Thanks, > Mark Adrien Rochereau - 08 Dec 2006 13:02 GMT Not sure what you are trying to achieve, but you could probably just control IE using activeX and just activate that button, that would be less prone to errors, sendkey might be a bit unreliable if it is to be used on other computers than yours?
see exemple here: http://www.dailydoseofexcel.com/archives/2004/09/22/automating-internet-explorer/
> Jim, > [quoted text clipped - 39 lines] > > Many Thanks, > > Mark- Hide quoted text -- Show quoted text - MarkHear1 - 08 Dec 2006 13:07 GMT Yes it will be used on other peoples computers, however i have no knowledge of activeX and would probably end up in a right mess!!! Unfortunately that website is blocked for me at work.
Thank you, Mark
> Not sure what you are trying to achieve, but you could probably just > control IE using activeX and just activate that button, that would be [quoted text clipped - 47 lines] > > > Many Thanks, > > > Mark- Hide quoted text -- Show quoted text - jlepack - 08 Dec 2006 14:25 GMT Hah! It's blocked because it has a link to a word like "D. Hicks" blog.
Someones web filtering is sensitive.
> Yes it will be used on other peoples computers, however i have no > knowledge of activeX and would probably end up in a right mess!!! [quoted text clipped - 54 lines] > > > > Many Thanks, > > > > Mark- Hide quoted text -- Show quoted text - MarkHear1 - 08 Dec 2006 14:41 GMT Possibly, although i think it might just be because it's link a message board (somehow it allows access to google message groups) but it's quite strict on message boards usually.
> Hah! It's blocked because it has a link to a word like "D. Hicks" > blog. [quoted text clipped - 59 lines] > > > > > Many Thanks, > > > > > Mark- Hide quoted text -- Show quoted text - MarkHear1 - 08 Dec 2006 14:43 GMT Hi Bob,
Thank you for your response, i some how managed to miss yours when i checked earlier.
I am now about to start a new topic about VB again, so if anybody fancies helping me with that .... :-)
Regards, Mark
> Possibly, although i think it might just be because it's link a message > board (somehow it allows access to google message groups) but it's [quoted text clipped - 63 lines] > > > > > > Many Thanks, > > > > > > Mark- Hide quoted text -- Show quoted text -
|
|
|