Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 146
Default Windows API Calls.

Hello, I'm just wondering if someone could explain why they would make calls
to Windows API? What this actually means, and what extra functionality this
gives VBA? I've seen a few good examples which include things from win32 api,
but I'm a little lost.

Thank you for any answers in advance.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Windows API Calls.

Why? Because they can do things that can't be done using native VBA, such as
resizing a userform in VBA. Basically, you are tapping directly into
operating system functions, extending the functionality, and often
increasing the performance.

I am sure that the question has more depth than that simple answer, but I am
not sure what.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"NateBuckley" wrote in message
...
Hello, I'm just wondering if someone could explain why they would make
calls
to Windows API? What this actually means, and what extra functionality
this
gives VBA? I've seen a few good examples which include things from win32
api,
but I'm a little lost.

Thank you for any answers in advance.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 146
Default Windows API Calls.

Thanks for the speedy reply,

That helped, I just simply had no idea about these Windows Api Calls, Quite
Intriguing, as I've never used them before.

I shall go forth and attempt to learn the basics.

Thank you.


"Bob Phillips" wrote:

Why? Because they can do things that can't be done using native VBA, such as
resizing a userform in VBA. Basically, you are tapping directly into
operating system functions, extending the functionality, and often
increasing the performance.

I am sure that the question has more depth than that simple answer, but I am
not sure what.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"NateBuckley" wrote in message
...
Hello, I'm just wondering if someone could explain why they would make
calls
to Windows API? What this actually means, and what extra functionality
this
gives VBA? I've seen a few good examples which include things from win32
api,
but I'm a little lost.

Thank you for any answers in advance.





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Windows API Calls.

I would add to the discussion that API calls are completely unforgiving. If
you provide an invalid value for a parameter, you are quite likely to
immediately crash the entire application (though probably not Windows
itself). SAVE YOUR WORK before calling code containing APIs unless you are
sure you have the correct data types and values. Pay attention to the ByVal
and ByRef modifiers in the API declaration -- they matter.

Note also that errors and return values that indicate error conditions are
completely independent and separate from any error handling you may have in
place using VB/VBA's On Error statements. On Error has no effect relative
to API calls. If, according the the API documentation, a function sets the
last error and that you can get further information using GetLastError, you
should use Err.LastDllError to get the error value generated by the API. The
error numbers reported by Err.LastDllError are different from the error
numbers used in Err.Number. Thus, the Err.Description property cannot be
used to get the text description of an error. If you need to get the text
description of an API-caused error, you need to use the FormatMessage API
function. I have code that wraps up FormatMessage in VB/VBA-friendly code at
http://www.cpearson.com/Excel/FormatMessage.aspx.


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)






"NateBuckley" wrote in message
...
Thanks for the speedy reply,

That helped, I just simply had no idea about these Windows Api Calls,
Quite
Intriguing, as I've never used them before.

I shall go forth and attempt to learn the basics.

Thank you.


"Bob Phillips" wrote:

Why? Because they can do things that can't be done using native VBA, such
as
resizing a userform in VBA. Basically, you are tapping directly into
operating system functions, extending the functionality, and often
increasing the performance.

I am sure that the question has more depth than that simple answer, but I
am
not sure what.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"NateBuckley" wrote in message
...
Hello, I'm just wondering if someone could explain why they would make
calls
to Windows API? What this actually means, and what extra functionality
this
gives VBA? I've seen a few good examples which include things from
win32
api,
but I'm a little lost.

Thank you for any answers in advance.






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


Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot open exel from windows xp in windows vista and visa versa lildiana New Users to Excel 4 February 25th 09 07:26 PM
Calls per Day Nate Excel Discussion (Misc queries) 1 September 17th 08 09:59 PM
can windows vista edit shared document from windows xp sasa Excel Worksheet Functions 1 January 9th 08 06:44 PM
XLA calls dll rodt Excel Programming 2 November 17th 03 10:08 PM
VBA Calls Rob Bovey Excel Programming 4 August 23rd 03 05:32 AM


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

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"