Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem with Excel 2003 and VBA to Open Doc

1 view
Skip to first unread message

bema

unread,
Apr 28, 2005, 9:18:10 AM4/28/05
to
We are trying to call System-DLL Functions zu get Temp-Folder-Path and
REgistry Settings.

We try to read RegOpenKeyA and RegQueryValue EXA and RegCloseKey out of
ADVAPI32.dll and try to read GetTempPathA aus Kernell32.dll.

This is working fine on some Pcs. But we have also trouble on others ! ??
The Registry Call delivers no failure and no value. GetTempPathA close with
failure Value 0

On the PCs with problems where is also another apllication using the
GetTempPathA Call with no problems.

How can we solve this ??


----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?mid=0e7379c7-64c6-4bb6-aa96-f531f208acae&dg=microsoft.public.excel.programming

Tom Ogilvy

unread,
Apr 28, 2005, 9:41:31 AM4/28/05
to
How about just using the Environ Variable:

? environ("Temp")
C:\DOCUME~1\OgilvyTW\LOCALS~1\Temp


--
Regards,
Tom Ogilvy


"bema" <be...@discussions.microsoft.com> wrote in message
news:0E7379C7-64C6-4BB6...@microsoft.com...

bema

unread,
Apr 29, 2005, 3:50:05 AM4/29/05
to
Thank you for your answer.

But this is not the solution for our problem. I know that I can take
"environ" instead of the kernel32.dll-function "GetTempPathA" to obtain the
TEMP-Path (or in Word but not in Excel "system.PrivateProfileString" for
registry-settings).

The strange behavior appears only on some workstations. On these computers I
am not able to call DLL-functions out of Word/Excel-VBA. Simple call's like
"GetTempPathA"
(kernel32.dll)
or "RegOpenKeyA", "RegQueryValueExA" or "RegCloseKey" (ADVAPI32.DLL) fails.

For example:
"GetTempPathA" returns 0 as result-values which means "error", but what error?
"RegQueryValueExA" returns no error but an empty string instead the real value

Are there any security-settings to prohibit external calls?

In other programming languages (like C++ or Delphi) we have no problem to
call these DLL-functions on the affected computers.

Please don't forget: For me it is important to call standard-DLL-functions!
These Word/Excel-macros works for 3 years without any problems; since Office
2003/XP SP2 there is this strange behavior on some (3 of about 25)
workstations.

0 new messages