Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > VBA / Office Integration > Excel > Problem using optional aguments on sub


Reply
 
Thread Tools Display Modes
  #1  
Old 05-13-2004, 04:29 AM
shiv_379 shiv_379 is offline
Junior Contributor
 
Join Date: Mar 2003
Location: London, UK
Posts: 218
Unhappy Problem using optional aguments on sub


Help! I am writing a sub like this:

Sub nextSection(Optional workbookPath As Variant, sheetName As String, cellRef As String, waitSeconds As Integer)
....
End Sub

But it keeps popping up with an error and telling me it expects sheetName to be option. It keeps this up with each one until I've declared everything optional!
Does anyone know what might be going on here?

-Shiv
__________________
~Shiv,
Business Intelligence Analyst
Reply With Quote
  #2  
Old 05-13-2004, 04:31 AM
shiv_379 shiv_379 is offline
Junior Contributor
 
Join Date: Mar 2003
Location: London, UK
Posts: 218
Default

Ahh...someone has solved it for me. The Optional argument has to be last in the list.

Sorry!
__________________
~Shiv,
Business Intelligence Analyst
Reply With Quote
  #3  
Old 05-13-2004, 02:24 PM
Jamirez's Avatar
Jamirez Jamirez is offline
Contributor
 
Join Date: Jan 2004
Location: Sherbrooke/Québec/Canada
Posts: 614
Default

Not the last, but everything that comes after a Optional parameter has to be Optional.
__________________
J a m i r e z

There are 10 type of people. Those which understand binary and those which do not understand it.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Map/Array/Room(x,y), amount of enemies... Hardest problem I've encountered so far... Kronikle66 Game Programming 16 09-30-2003 02:07 PM
ADO Recorset Problem coco286 Database and Reporting 1 09-28-2003 09:08 PM
Problem with VB6->Excel jluisfer Excel 7 09-07-2003 07:46 AM
Problem with DDE and Excel 97 beans4you Word, PowerPoint, Outlook, and Other Office Products 0 12-24-2002 01:05 PM
Help with problem with Excel Automation within VB6 seidenstud Word, PowerPoint, Outlook, and Other Office Products 1 12-18-2002 11:44 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->