Hi Dave,
Sorry for getting back so late... Was busy.
> I doubt that there is any single property in all the products
> for this.
Actually there is.... The Application object.
However, although I've said the code is generic... it does depend on an If..
Elseif.. Elseif.. Endif.. Else.. structure. So a set of *strings* are set
depending on which application I'm in and which object to address.
The trick is that the objects set and properties are "encoded" in the
CallByName function as *strings* so the application can still compile with
no errors in all applications.
Ive used what I think is a pretty dare I say it again.. Officeversal API...
Please don't hit me!!! ... to get the calling application and used that as
well so I can confidently say the routine will work in all applications for
all objects *as long as the appropriate strings are set up for the
CallByName function".
At the moment I'm using it in Excel but have tested it in Word Outlook and
Access with no problems.
I've added some code for developing so there is a parameter for a DEVELOP
folder and a database... That could be Word Excel Access ... So I record a
comment for each new version.
Still playing a bit.... Want it though?... No probos... Will send you the
code if you do and if there is more interest will post it on the site.
> > My thinking is that APIs are officeversal ...
>
> No, definitely not.
Depends on the API IMHO.
> these Object Models
> have evolved from earlier versions that didn't have VBA, so
> there wasn't
> any common basis for their design.
Agree... Lots from different authors as software was "aquired". And some
blame has to go to the splintered organisation of microsoft at that time...
One group working on Excel.. One on word and so on... And the amount of er..
communication between them. Having said that... I actually think they all
did their best.
Regards
Lisa
> Subject: RE: [ExcelVBA] Get the save as folder
>
> > I'd like to use the same routine for Word and
> > Outlook and Access...
>
> I doubt that there is any single property in all the products
> for this.
> The products have different origins and very different object models.
> In fact, I'm not sure that all of them (e.g. Outlook) have such a
> setting.
>
> > My thinking is that APIs are officeversal ...
>
> No, definitely not. VBA (the programming language itself) is
> consistent
> enough across the products, but the Object Model that represents the
> product and its files is completely different (and reasonably so,
> because the products are so very different). Also, these
> Object Models
> have evolved from earlier versions that didn't have VBA, so
> there wasn't
> any common basis for their design.
>
> Regards, Dave S
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Tidak ada komentar:
Posting Komentar