Problem with Excel 2003 and VBA to Open Doc

G

Guest

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/communitie...208acae&dg=microsoft.public.excel.programming
 
T

Tom Ogilvy

How about just using the Environ Variable:

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


--
Regards,
Tom Ogilvy


bema said:
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/communitie...208acae&dg=microsoft.public.excel.programming
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top