Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi. I'm coming to VBA from a C/C++/Java background (and the syntax
makes me want to throw up, by the way--I plan to discontinue using VBA as soon as possible--it would be nice if MS would give another language option for scripting Office). Anyway, can anyone tell me a VBA operator which jumps to the next iteration of a loop similar to the C operator 'continue'? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
kramer31 wrote:
Hi. I'm coming to VBA from a C/C++/Java background (and the syntax makes me want to throw up, by the way--I plan to discontinue using VBA as soon as possible--it would be nice if MS would give another language option for scripting Office). Anyway, can anyone tell me a VBA operator which jumps to the next iteration of a loop similar to the C operator 'continue'? GoTo Honestly, it's likely the best - just add a label at the bottom of your loop. Or you could define a block structure within the loop by using one of the /other/ loop constructs, and then "Exit For" or "Exit Do" when you need to. That's what I usually do. Bob -- |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Go back to C. There is no such operator in VBA, the closest that you can come
is GoTo. Something like this: For cnt = 1 to 4 If cnt = 2 Then GoTo Nextcnt Nextcnt: Next -- Charles Chickering "A good example is twice the value of good advice." "kramer31" wrote: Hi. I'm coming to VBA from a C/C++/Java background (and the syntax makes me want to throw up, by the way--I plan to discontinue using VBA as soon as possible--it would be nice if MS would give another language option for scripting Office). Anyway, can anyone tell me a VBA operator which jumps to the next iteration of a loop similar to the C operator 'continue'? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'll just use an If block, I have a pretty firm personal rule against
using gotos. I'd love to go back to C, but I have to write some scripts in Excel. Why doesn't MS offer a better language for scripting Office? It would be awesome if I could use Perl to script Office. Do you guys know how powerful that language is? Charles Chickering wrote: Go back to C. There is no such operator in VBA, the closest that you can come is GoTo. Something like this: For cnt = 1 to 4 If cnt = 2 Then GoTo Nextcnt Nextcnt: Next -- Charles Chickering "A good example is twice the value of good advice." "kramer31" wrote: Hi. I'm coming to VBA from a C/C++/Java background (and the syntax makes me want to throw up, by the way--I plan to discontinue using VBA as soon as possible--it would be nice if MS would give another language option for scripting Office). Anyway, can anyone tell me a VBA operator which jumps to the next iteration of a loop similar to the C operator 'continue'? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You just create a condition that only does the stuff if TRUE
For i = 1 To 100 If some_condition Then 'do your stuff End If Next i so you always do the next iteration, but only do something before the iteration is the condition is met. -- HTH Bob Phillips (replace xxxx in the email address with gmail if mailing direct) "kramer31" wrote in message ups.com... Hi. I'm coming to VBA from a C/C++/Java background (and the syntax makes me want to throw up, by the way--I plan to discontinue using VBA as soon as possible--it would be nice if MS would give another language option for scripting Office). Anyway, can anyone tell me a VBA operator which jumps to the next iteration of a loop similar to the C operator 'continue'? |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
visual basic script (VBS) works well in Office...
Microsoft Windows Script 5.6 Documentation http://msdn.microsoft.com/library/de...ist/webdev.asp -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware "kramer31" wrote in message I'll just use an If block, I have a pretty firm personal rule against using gotos. I'd love to go back to C, but I have to write some scripts in Excel. Why doesn't MS offer a better language for scripting Office? It would be awesome if I could use Perl to script Office. Do you guys know how powerful that language is? |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If not abused, there's nothing wrong with a GOTO. If you insist on not
using it and would rather labor over code to bypass it, code on! Each language has its pluses and minuses. Personally, I can't stand C. But that doesn't mean I really like VB ;-) Have you looked into the .NET languages? -- Toby Erkson http://www.bidata.net/ "kramer31" wrote in message oups.com... I'll just use an If block, I have a pretty firm personal rule against using gotos. I'd love to go back to C, but I have to write some scripts in Excel. Why doesn't MS offer a better language for scripting Office? It would be awesome if I could use Perl to script Office. Do you guys know how powerful that language is? Charles Chickering wrote: Go back to C. There is no such operator in VBA, the closest that you can come is GoTo. Something like this: For cnt = 1 to 4 If cnt = 2 Then GoTo Nextcnt Nextcnt: Next -- Charles Chickering "A good example is twice the value of good advice." "kramer31" wrote: Hi. I'm coming to VBA from a C/C++/Java background (and the syntax makes me want to throw up, by the way--I plan to discontinue using VBA as soon as possible--it would be nice if MS would give another language option for scripting Office). Anyway, can anyone tell me a VBA operator which jumps to the next iteration of a loop similar to the C operator 'continue'? |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() visual basic script (VBS) works well in Office... It works well enough, but the syntax is completely revolting ... and it you don't gain any power for the disgusting syntax. Perl is much more powerful and what would be wrong with offering multiple scripting languages. |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Obviously you are more familiar with C, but what exactly is wrong with VBA?
RBS "kramer31" wrote in message ups.com... Hi. I'm coming to VBA from a C/C++/Java background (and the syntax makes me want to throw up, by the way--I plan to discontinue using VBA as soon as possible--it would be nice if MS would give another language option for scripting Office). Anyway, can anyone tell me a VBA operator which jumps to the next iteration of a loop similar to the C operator 'continue'? |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
So just so we are all on the same page... On one hand you are asking for our
help and on the other hand you are belittling the language were we have chosen to gain our expertise... Does that strike you as odd. I have worked in C, C++, Java, VB, ... and I can say that there is good and bad in all of them. I feel that VB is well suited to being a scripting language for Excel as it is very english like in it's synatax and relatively easy to write and debug. It does all of the memory handling and it is very user friendly when creating userforms... Is it perfect. Heck no. But either are the other languages. Bob Phillips posted a perfectly good response to your question. It is simple and it will work. It does not use goto's and it is not far off what you would have written in C/C++. -- HTH... Jim Thomlinson "kramer31" wrote: visual basic script (VBS) works well in Office... It works well enough, but the syntax is completely revolting ... and it you don't gain any power for the disgusting syntax. Perl is much more powerful and what would be wrong with offering multiple scripting languages. |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Your welcome. By the way, do you know "Aaron"?
Sincerely, Jim Cone "kramer31" wrote in message visual basic script (VBS) works well in Office... It works well enough, but the syntax is completely revolting ... and it you don't gain any power for the disgusting syntax. Perl is much more powerful and what would be wrong with offering multiple scripting languages. |
#12
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Depending on exactly what you are doing, you might want to investigate
"Visual Studio Tools For Office". This allows you to write code in any of the NET languages, including (managed) C++. -- Cordially, Chip Pearson Microsoft MVP - Excel www.cpearson.com (email address is on the web site) "kramer31" wrote in message ups.com... visual basic script (VBS) works well in Office... It works well enough, but the syntax is completely revolting ... and it you don't gain any power for the disgusting syntax. Perl is much more powerful and what would be wrong with offering multiple scripting languages. |
#13
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() RB Smissaert wrote: Obviously you are more familiar with C, but what exactly is wrong with VBA? RBS A lot of it is my familiarity. I hate learning a new language when it is actually less functional than one that I already know. Especially when it uses funky syntax like VB. There are a whole huge family of languages that use C syntax and it's great. I'm not sure why I want to type 'End If' when I can type '}'. I don't necessarily think that C is appropriate for a scripting language for Office, but Perl would be brilliant. The built in hash capability would be awesome to use in Excel. |
#14
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I should have added that if you are working on an add-in, or can change the
nature of your project to an add-in, you can write a COM Add-In in any language you want. -- Cordially, Chip Pearson Microsoft MVP - Excel www.cpearson.com (email address is on the web site) "Chip Pearson" wrote in message ... Depending on exactly what you are doing, you might want to investigate "Visual Studio Tools For Office". This allows you to write code in any of the NET languages, including (managed) C++. -- Cordially, Chip Pearson Microsoft MVP - Excel www.cpearson.com (email address is on the web site) "kramer31" wrote in message ups.com... visual basic script (VBS) works well in Office... It works well enough, but the syntax is completely revolting ... and it you don't gain any power for the disgusting syntax. Perl is much more powerful and what would be wrong with offering multiple scripting languages. |
#15
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Still not clear what is wrong with VBA.
I am sure there must be some way to use the functionality of a hash table. RBS "kramer31" wrote in message oups.com... RB Smissaert wrote: Obviously you are more familiar with C, but what exactly is wrong with VBA? RBS A lot of it is my familiarity. I hate learning a new language when it is actually less functional than one that I already know. Especially when it uses funky syntax like VB. There are a whole huge family of languages that use C syntax and it's great. I'm not sure why I want to type 'End If' when I can type '}'. I don't necessarily think that C is appropriate for a scripting language for Office, but Perl would be brilliant. The built in hash capability would be awesome to use in Excel. |
#16
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Jim, how do you tell Excel to use VBS instead of VBA?
|
#17
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I thought "GoTo" was created for people who cannot think logically, so they
would have a way out of the mess they got themselves into. "RB Smissaert" wrote: Still not clear what is wrong with VBA. I am sure there must be some way to use the functionality of a hash table. RBS "kramer31" wrote in message oups.com... RB Smissaert wrote: Obviously you are more familiar with C, but what exactly is wrong with VBA? RBS A lot of it is my familiarity. I hate learning a new language when it is actually less functional than one that I already know. Especially when it uses funky syntax like VB. There are a whole huge family of languages that use C syntax and it's great. I'm not sure why I want to type 'End If' when I can type '}'. I don't necessarily think that C is appropriate for a scripting language for Office, but Perl would be brilliant. The built in hash capability would be awesome to use in Excel. |
#18
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Stop complaining and get with the WORLD STANDARD!
If you think VBA is bad just wait til you see VBScript. |
#19
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you have coherent vbs code, in an appropriate module, Excel will run it.
You have to either... 1. Set a reference to the "MicrosoftScriptingRuntime" library in Tools | References (in the VBE). Then this works...Set oFso = Scripting.FileSystemObject -or- 2. Use "CreateObject" to tell Excel what your code is referring to. ...Set oFso = CreateObject("Scripting.FileSystemObject") Excel will then recognize all of the properties and methods of the object. You can then intermix it with your regular vba code. The help file I referenced in my previous post has good examples and most English proficient users can easily discern what the code does by just reading it. Also, there is a MS newsgroup devoted to vbs. -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware wrote in message Hi Jim, how do you tell Excel to use VBS instead of VBA? |
#20
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I can't think why I would want to type ";" at the end of every line when I
could type nothing :) -- Charles Chickering "A good example is twice the value of good advice." "kramer31" wrote: RB Smissaert wrote: Obviously you are more familiar with C, but what exactly is wrong with VBA? RBS A lot of it is my familiarity. I hate learning a new language when it is actually less functional than one that I already know. Especially when it uses funky syntax like VB. There are a whole huge family of languages that use C syntax and it's great. I'm not sure why I want to type 'End If' when I can type '}'. I don't necessarily think that C is appropriate for a scripting language for Office, but Perl would be brilliant. The built in hash capability would be awesome to use in Excel. |
#21
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
May be you look should to using OpenOffice which does not use VBA.
Then you would not be so revolted by this useful this MS product. NickHK "kramer31" wrote in message ups.com... visual basic script (VBS) works well in Office... It works well enough, but the syntax is completely revolting ... and it you don't gain any power for the disgusting syntax. Perl is much more powerful and what would be wrong with offering multiple scripting languages. |
#22
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
only if Perl is used for databases <g
"Jim Cone" wrote: Your welcome. By the way, do you know "Aaron"? Sincerely, Jim Cone "kramer31" wrote in message visual basic script (VBS) works well in Office... It works well enough, but the syntax is completely revolting ... and it you don't gain any power for the disgusting syntax. Perl is much more powerful and what would be wrong with offering multiple scripting languages. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
to continue down in the same row | Excel Discussion (Misc queries) | |||
Continue | Excel Programming | |||
Find a value if there continue | Excel Programming | |||
Abort or continue | Excel Programming | |||
Abort or continue | Excel Programming |