View Single Post
 
Old 07-22-2014, 10:15 AM
BobBridges's Avatar
BobBridges BobBridges is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

Gbaker, Ribbons had the right form. But maybe this is a good time to help you know more about writing code, if you want to take the time for it.

The statement you suggested...
Code:
ThisWorkbook.SAVEAS = varResult
...would take the value of varResult and put it in another variable named SaveAs—in this case a variable that belongs to an object named ThisWorkbook. But SaveAs isn't a variable (or "property") of ThisWorkbook, it's something called a "method", ie it does something. So it's as though "ThisWorkbook.SaveAs" is a command, and "varResult" is the argument you supply to tell it how to carry out that command. In this case, SaveAs is a command to save ThisWorkbook under a new name, and varResult contains the name to be used.

So how do you know when something is a property and when it's a method? Sometimes it's obvious; but when it isn't, you have to look it up in the documentation. Do you know where the VBA/Excel documentation is? Because if you don't, it's well worth knowing. I can give you some pointers for looking through it, if you need them.
Reply With Quote