PC Review


Reply
Thread Tools Rate Thread

Can we use variables in XL macros?

 
 
Patrick Molloy
Guest
Posts: n/a
 
      2nd Jun 2009
sure:

DIM sPath as String
sPath = "c:\windows\temp"
Shell sPath

"StargateFan" <IDon'(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have little experience scripting generally, but have a lot with
> AutoIt, a freeware scripting language. One of the very cool features
> is the way we can use variables to make life a whole lot easier, for
> example.
>
> ;=======================
> $Path = "c:\windows\temp"
> ;=======================
>
> Shellexecute($Path)
>
>
> The advantage of the above is that it's easy to make a script that you
> just plug in the changing values at the top and then not touch the
> content. This is a very simpe example, but sometimes things can get
> pretty complicated and using variables in this manner really
> simplifies things.
>
> Is there a comparable system in Excel so that we can put all variables
> at the top and leave the rest of the script to do the tasks?
>
> Thanks! D
>

 
Reply With Quote
 
 
 
 
Peter T
Guest
Posts: n/a
 
      2nd Jun 2009
At the top of the module

Private Const cPATH As String = "c:\windows\temp"
Public Const cNUM as Long = 123

The private constant will be visible to all procedures in the module, the
public one throughout the project.

Regards,
Peter T


"StargateFan" <IDon'(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have little experience scripting generally, but have a lot with
> AutoIt, a freeware scripting language. One of the very cool features
> is the way we can use variables to make life a whole lot easier, for
> example.
>
> ;=======================
> $Path = "c:\windows\temp"
> ;=======================
>
> Shellexecute($Path)
>
>
> The advantage of the above is that it's easy to make a script that you
> just plug in the changing values at the top and then not touch the
> content. This is a very simpe example, but sometimes things can get
> pretty complicated and using variables in this manner really
> simplifies things.
>
> Is there a comparable system in Excel so that we can put all variables
> at the top and leave the rest of the script to do the tasks?
>
> Thanks! D
>



 
Reply With Quote
 
StargateFan
Guest
Posts: n/a
 
      2nd Jun 2009
I have little experience scripting generally, but have a lot with
AutoIt, a freeware scripting language. One of the very cool features
is the way we can use variables to make life a whole lot easier, for
example.

;=======================
$Path = "c:\windows\temp"
;=======================

Shellexecute($Path)


The advantage of the above is that it's easy to make a script that you
just plug in the changing values at the top and then not touch the
content. This is a very simpe example, but sometimes things can get
pretty complicated and using variables in this manner really
simplifies things.

Is there a comparable system in Excel so that we can put all variables
at the top and leave the rest of the script to do the tasks?

Thanks! D

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HOW TO USE VARIABLES IN MACROS ezil Microsoft Access VBA Modules 2 1st Nov 2009 03:16 PM
Macros with Variables Carol Microsoft Word Document Management 2 27th Aug 2004 07:49 AM
Variables in Macros Dan Microsoft Excel Worksheet Functions 1 23rd Jun 2004 02:36 PM
Variables in Macros? JasonSelf Microsoft Access Macros 1 1st May 2004 08:44 AM
Variables in Macros? JasonSelf Microsoft Access Macros 0 29th Apr 2004 11:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:40 PM.