PC Review


Reply
Thread Tools Rate Thread

Can't create ini file on a Vista machine

 
 
Bob Flanagan
Guest
Posts: n/a
 
      21st Mar 2007
I tried the following in both Excel 2003 and 2007 on a Vista machine:

Sub Test()
Dim I As Integer
I = FreeFile
fName = "C:\aaa.ini"
Open fName For Output As #1
Print #1, "Test"
Close #1
End Sub

I get a Path/Fle access error on the Open line. The above works perfect in
other versions of Excel. I tried different folders and still no joy.

When I tried manually saving a workbook to the programs file directory where
the add-in was located, to the root C drive and to the windows temp
directory. , I get a "you don't have permissions" error message each time.
Most likely this is what is triggering the path/file error. I guess I could
save to the my documents directory, but the file is not one the user needs
to see. And if they see it, they are likely to delete

Any ideas on how to solve?

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel


 
Reply With Quote
 
 
 
 
Ron de Bruin
Guest
Posts: n/a
 
      21st Mar 2007
Hi Bob

C:\ is protected in Vista

Create a folder for your add-in in a unprotected area on you hard disk


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Bob Flanagan" <(E-Mail Removed)> wrote in message news(E-Mail Removed)...
>I tried the following in both Excel 2003 and 2007 on a Vista machine:
>
> Sub Test()
> Dim I As Integer
> I = FreeFile
> fName = "C:\aaa.ini"
> Open fName For Output As #1
> Print #1, "Test"
> Close #1
> End Sub
>
> I get a Path/Fle access error on the Open line. The above works perfect in
> other versions of Excel. I tried different folders and still no joy.
>
> When I tried manually saving a workbook to the programs file directory where
> the add-in was located, to the root C drive and to the windows temp
> directory. , I get a "you don't have permissions" error message each time.
> Most likely this is what is triggering the path/file error. I guess I could
> save to the my documents directory, but the file is not one the user needs
> to see. And if they see it, they are likely to delete
>
> Any ideas on how to solve?
>
> Bob Flanagan
> Macro Systems
> http://www.add-ins.com
> Productivity add-ins and downloadable books on VB macros for Excel
>
>

 
Reply With Quote
 
Bob Flanagan
Guest
Posts: n/a
 
      21st Mar 2007
Hi Ron. This thread appeared finally in my news reader. Sounds like it
will be better to create registry entries instead. At lieast that can be
done across platforms.

Bob

"Ron de Bruin" <(E-Mail Removed)> wrote in message
news:eVvcjQ$(E-Mail Removed)...
> Hi Bob
>
> C:\ is protected in Vista
>
> Create a folder for your add-in in a unprotected area on you hard disk
>
>
> --
>
> Regards Ron de Bruin
> http://www.rondebruin.nl/tips.htm
>
>
> "Bob Flanagan" <(E-Mail Removed)> wrote in message
> news(E-Mail Removed)...
>>I tried the following in both Excel 2003 and 2007 on a Vista machine:
>>
>> Sub Test()
>> Dim I As Integer
>> I = FreeFile
>> fName = "C:\aaa.ini"
>> Open fName For Output As #1
>> Print #1, "Test"
>> Close #1
>> End Sub
>>
>> I get a Path/Fle access error on the Open line. The above works perfect
>> in other versions of Excel. I tried different folders and still no joy.
>>
>> When I tried manually saving a workbook to the programs file directory
>> where the add-in was located, to the root C drive and to the windows temp
>> directory. , I get a "you don't have permissions" error message each
>> time. Most likely this is what is triggering the path/file error. I guess
>> I could save to the my documents directory, but the file is not one the
>> user needs to see. And if they see it, they are likely to delete
>>
>> Any ideas on how to solve?
>>
>> Bob Flanagan
>> Macro Systems
>> http://www.add-ins.com
>> Productivity add-ins and downloadable books on VB macros for Excel
>>


 
Reply With Quote
 
Peter Grebenik
Guest
Posts: n/a
 
      21st Mar 2007
I don't know whether its just a typo, but you should have:

Sub Test()
Dim I As Integer
I = FreeFile
fName = "C:\aaa.ini"
Open fName For Output As I 'not #1
Print #I, "Test" 'not #1
Close I
End Sub

Just a thought.

Peter

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      21st Mar 2007
Yes that is also a good option

In Vista if you copy a add-in in the Library folder and have a option in the add-in to change
things and save the changes in the Add-in then you also have a problem.

The Library folder is also protected


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Bob Flanagan" <(E-Mail Removed)> wrote in message news:Q5udnWqAcvEEBZzbnZ2dnUVZ_u-(E-Mail Removed)...
> Hi Ron. This thread appeared finally in my news reader. Sounds like it
> will be better to create registry entries instead. At lieast that can be
> done across platforms.
>
> Bob
>
> "Ron de Bruin" <(E-Mail Removed)> wrote in message
> news:eVvcjQ$(E-Mail Removed)...
>> Hi Bob
>>
>> C:\ is protected in Vista
>>
>> Create a folder for your add-in in a unprotected area on you hard disk
>>
>>
>> --
>>
>> Regards Ron de Bruin
>> http://www.rondebruin.nl/tips.htm
>>
>>
>> "Bob Flanagan" <(E-Mail Removed)> wrote in message
>> news(E-Mail Removed)...
>>>I tried the following in both Excel 2003 and 2007 on a Vista machine:
>>>
>>> Sub Test()
>>> Dim I As Integer
>>> I = FreeFile
>>> fName = "C:\aaa.ini"
>>> Open fName For Output As #1
>>> Print #1, "Test"
>>> Close #1
>>> End Sub
>>>
>>> I get a Path/Fle access error on the Open line. The above works perfect
>>> in other versions of Excel. I tried different folders and still no joy.
>>>
>>> When I tried manually saving a workbook to the programs file directory
>>> where the add-in was located, to the root C drive and to the windows temp
>>> directory. , I get a "you don't have permissions" error message each
>>> time. Most likely this is what is triggering the path/file error. I guess
>>> I could save to the my documents directory, but the file is not one the
>>> user needs to see. And if they see it, they are likely to delete
>>>
>>> Any ideas on how to solve?
>>>
>>> Bob Flanagan
>>> Macro Systems
>>> http://www.add-ins.com
>>> Productivity add-ins and downloadable books on VB macros for Excel
>>>

>

 
Reply With Quote
 
Mark Jones
Guest
Posts: n/a
 
      22nd Mar 2007
Ron de Bruin wrote:
> Hi Bob
>
> C:\ is protected in Vista
>
> Create a folder for your add-in in a unprotected area on you hard disk


Is there a way to make these protected areas into
unprotected areas?


 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      22nd Mar 2007
Hi Mark

In the properties of a folder there is a security tab
You can chnage the security there
But not all Vista versions have that tab

Read this from help

***********
Why is the Security tab missing from my file and folder properties?

The Security tab is not available on file and folder properties in Windows Vista Home Premium,
Windows Vista Home Basic, and Windows Vista Starter.
The Security tab also is not available if you are using the FAT or FAT32 file system
*************

Use the users folder to avoid problems
"C:\Users\Ron\test\"

You can build the string with
Environ("UserName")



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Mark Jones" <(E-Mail Removed)> wrote in message news:ZnuMh.16292$(E-Mail Removed)...
> Ron de Bruin wrote:
>> Hi Bob
>>
>> C:\ is protected in Vista
>>
>> Create a folder for your add-in in a unprotected area on you hard disk

>
> Is there a way to make these protected areas into
> unprotected areas?
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't create a new file or folder with in a shared folder on a Windows XP machine. Basic Vista networking questions Nate Goulet Windows Vista Installation 4 18th Apr 2007 10:20 AM
Importing pst file from Outlook 2003 (XP Machine) to Outlook 2007 (Vista Machine) - having problems Outish Microsoft Outlook 4 7th Feb 2007 04:06 PM
Moving NK2 File from XP machine to Vista machine =?Utf-8?B?RGFycmlu?= Microsoft Outlook Contacts 5 2nd Feb 2007 09:53 PM
Create file in local user-machine Bnob Microsoft ASP .NET 4 11th Oct 2004 01:15 PM
How create a file on users machine (ASP.NET)? VB Programmer Microsoft ASP .NET 5 4th Nov 2003 02:23 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:12 AM.