Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default VBA continue

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default VBA continue

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 272
Default VBA continue

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default VBA continue

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 380
Default VBA continue

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default VBA continue

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default VBA continue

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default VBA continue


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default VBA continue

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default VBA continue

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default VBA continue

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default VBA continue

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default VBA continue


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default VBA continue

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default VBA continue

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default VBA continue

Hi Jim, how do you tell Excel to use VBS instead of VBA?

  #17   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default VBA continue

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default VBA continue

Stop complaining and get with the WORLD STANDARD!

If you think VBA is bad just wait til you see VBScript.

  #19   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default VBA continue

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 272
Default VBA continue

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default VBA continue

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   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default VBA continue

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
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
to continue down in the same row alex178 Excel Discussion (Misc queries) 2 July 8th 06 05:34 PM
Continue Steph[_6_] Excel Programming 0 January 31st 06 05:50 PM
Find a value if there continue Tempy Excel Programming 2 May 19th 04 08:53 PM
Abort or continue Jason Gatsby Excel Programming 0 August 5th 03 02:16 AM
Abort or continue Ed Ferrero[_4_] Excel Programming 0 August 5th 03 02:01 AM


All times are GMT +1. The time now is 04:11 AM.

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"