Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Vba - := ????


Group,
I often see examples of VBA code using the := (colon equal). Wha
is this and what is it typically used for? It appears to be some for
of assignment.

Thank you in advance........

Ton

--
ajociu
-----------------------------------------------------------------------
ajocius's Profile: http://www.excelforum.com/member.php...fo&userid=1769
View this thread: http://www.excelforum.com/showthread.php?threadid=39211

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Vba - := ????

Tony,

For many methods, named parameters are used, and the := is used to assign a value to the named
parameter. For example, you could use either of these with the find method:

Dim c As Range
Set c = Cells.Find(What:="myFindString", LookIn:=xlValues, lookAt:=xlWhole)
This example leaves out the After:= parameter (but doesn't require a space holder for it).

Set c = Cells.Find("myFindString", , , xlWhole)
This one leaves out the parameter names (and skips the After and LookIn parameters) but requires
space holders (the commas).

HTH,
Bernie
MS Excel MVP


"ajocius" wrote in message
...

Group,
I often see examples of VBA code using the := (colon equal). What
is this and what is it typically used for? It appears to be some form
of assignment.

Thank you in advance........

Tony


--
ajocius
------------------------------------------------------------------------
ajocius's Profile: http://www.excelforum.com/member.php...o&userid=17695
View this thread: http://www.excelforum.com/showthread...hreadid=392118



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Vba - := ????


It's mostly to make things easier with argument lists
Example:
You want to open a workbook from a macro and have it go in the recently
used file list. The syntax for the open method is:

expression.Open(FileName, UpdateLinks, ReadOnly, Format, Password,
WriteResPassword, IgnoreReadOnlyRecommended, Origin, Delimiter,
Editable, Notify, Converter, AddToMRU)

You need to set AddToMRU to true. You could go through and re-enter
all the defaults for the other arguments like
Workbooks.Open("file.xls", false, false,....., true) and you have to go
figure out what all needs to go there or you could type:

Workbooks.Open "file.xls", AddToMRU := true

Saves a lot of typing.


--
TommySzalapski
------------------------------------------------------------------------
TommySzalapski's Profile: http://www.excelforum.com/member.php...o&userid=25561
View this thread: http://www.excelforum.com/showthread...hreadid=392118

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Vba - := ????

You could go through and re-enter
all the defaults for the other arguments like
Workbooks.Open("file.xls", false, false,....., true) and you
have to go
figure out what all needs to go there


Or you can omit the arguments altogether and use commas as place
holders. But in any case, named arguments are by far the best way
to go.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"TommySzalapski"
<TommySzalapski.1t546n_1122991574.8252@excelforu m-nospam.com
wrote in message
news:TommySzalapski.1t546n_1122991574.8252@excelfo rum-nospam.com...

It's mostly to make things easier with argument lists
Example:
You want to open a workbook from a macro and have it go in the
recently
used file list. The syntax for the open method is:

expression.Open(FileName, UpdateLinks, ReadOnly, Format,
Password,
WriteResPassword, IgnoreReadOnlyRecommended, Origin, Delimiter,
Editable, Notify, Converter, AddToMRU)

You need to set AddToMRU to true. You could go through and
re-enter
all the defaults for the other arguments like
Workbooks.Open("file.xls", false, false,....., true) and you
have to go
figure out what all needs to go there or you could type:

Workbooks.Open "file.xls", AddToMRU := true

Saves a lot of typing.


--
TommySzalapski
------------------------------------------------------------------------
TommySzalapski's Profile:
http://www.excelforum.com/member.php...o&userid=25561
View this thread:
http://www.excelforum.com/showthread...hreadid=392118



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Vba - := ????

Not quite as bad as you make out

expression.Open(FileName, UpdateLinks, ReadOnly, Format, Password,
WriteResPassword, IgnoreReadOnlyRecommended, Origin, Delimiter,
Editable, Notify, Converter, AddToMRU)


You need to set AddToMRU to true. You could go through and re-enter

all the defaults for the other arguments like

or just
Workbooks.Open("file.xls",,,,,,,,,,,,true)

but using named arguments still saves some typing in many cases.

--
Regards,
Tom Ogilvy

"TommySzalapski"
<TommySzalapski.1t546n_1122991574.8252@excelforu m-nospam.com wrote in
message news:TommySzalapski.1t546n_1122991574.8252@excelfo rum-nospam.com...

It's mostly to make things easier with argument lists
Example:
You want to open a workbook from a macro and have it go in the recently
used file list. The syntax for the open method is:

expression.Open(FileName, UpdateLinks, ReadOnly, Format, Password,
WriteResPassword, IgnoreReadOnlyRecommended, Origin, Delimiter,
Editable, Notify, Converter, AddToMRU)

You need to set AddToMRU to true. You could go through and re-enter
all the defaults for the other arguments like
Workbooks.Open("file.xls", false, false,....., true) and you have to go
figure out what all needs to go there or you could type:

Workbooks.Open "file.xls", AddToMRU := true

Saves a lot of typing.


--
TommySzalapski
------------------------------------------------------------------------
TommySzalapski's Profile:

http://www.excelforum.com/member.php...o&userid=25561
View this thread: http://www.excelforum.com/showthread...hreadid=392118



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



All times are GMT +1. The time now is 06:21 AM.

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

About Us

"It's about Microsoft Excel"