Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Mon, 31 Mar 2008 08:22:02 -0700,    group: microsoft.public.word.vba.customization        back       


System.Privateprofilestring   
Hello All:
I have a custom template running in word . The users input is stored and 
retrieved from a INI file residing on the user's computer and the method of 
writing and reading form the INI file was to use system.privateprofilestring. 
This worked perfectly in word 2003 and now in word 2007 I get an error 
message for this method. I am using windows xp professional. Can anyone shed 
some light on how I can fix this? Any help would be greatly appreciated.

Thanks,
Manju.
date: Mon, 31 Mar 2008 08:22:02 -0700   author:   Manju

Re: System.Privateprofilestring   
I know of no inherent reason that System.PrivateProfileString will not work 
with Word 2007.  I have however encountered problems that I believe are 
timing issues with its use.

My situation was that I was running an application from Outlook, writing a 
contacts details to an .ini file, then the application was starting Word and 
attempting to populate the controls on a userform by using the 
System.PrivateProfileString in the initialize statement of the form.

In that case the error that was being returned was that the object had been 
deleted, which I tool to mean that it had not yet been created.

You don't say at what point you experiencing the errors, but you might try 
using an OnTime statement to provide an opportunity for the values to be 
written before proceeding to the next step.

-- 
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Manju"  wrote in message 
news:0A767FC0-1482-40AC-88DD-5063098208D7@microsoft.com...
> Hello All:
> I have a custom template running in word . The users input is stored and
> retrieved from a INI file residing on the user's computer and the method 
> of
> writing and reading form the INI file was to use 
> system.privateprofilestring.
> This worked perfectly in word 2003 and now in word 2007 I get an error
> message for this method. I am using windows xp professional. Can anyone 
> shed
> some light on how I can fix this? Any help would be greatly appreciated.
>
> Thanks,
> Manju.
>
date: Tue, 1 Apr 2008 14:38:41 +1000   author:   Doug Robbins - Word MVP

Re: System.Privateprofilestring   
Thanks Doug. Although I did not write the OnTime statement your comment 
sparked off a thought that if I write to the INI file before the focus shifts 
to the word template it might work. I did just that and it works now.
Thanks again,
Manju.

"Doug Robbins - Word MVP" wrote:

> I know of no inherent reason that System.PrivateProfileString will not work 
> with Word 2007.  I have however encountered problems that I believe are 
> timing issues with its use.
> 
> My situation was that I was running an application from Outlook, writing a 
> contacts details to an .ini file, then the application was starting Word and 
> attempting to populate the controls on a userform by using the 
> System.PrivateProfileString in the initialize statement of the form.
> 
> In that case the error that was being returned was that the object had been 
> deleted, which I tool to mean that it had not yet been created.
> 
> You don't say at what point you experiencing the errors, but you might try 
> using an OnTime statement to provide an opportunity for the values to be 
> written before proceeding to the next step.
> 
> -- 
> Hope this helps.
> 
> Please reply to the newsgroup unless you wish to avail yourself of my
> services on a paid consulting basis.
> 
> Doug Robbins - Word MVP
> 
> "Manju"  wrote in message 
> news:0A767FC0-1482-40AC-88DD-5063098208D7@microsoft.com...
> > Hello All:
> > I have a custom template running in word . The users input is stored and
> > retrieved from a INI file residing on the user's computer and the method 
> > of
> > writing and reading form the INI file was to use 
> > system.privateprofilestring.
> > This worked perfectly in word 2003 and now in word 2007 I get an error
> > message for this method. I am using windows xp professional. Can anyone 
> > shed
> > some light on how I can fix this? Any help would be greatly appreciated.
> >
> > Thanks,
> > Manju.
> > 
> 
> 
>
date: Tue, 1 Apr 2008 12:41:01 -0700   author:   Manju

Re: System.Privateprofilestring   
"Manju"  wrote in message 
news:0A767FC0-1482-40AC-88DD-5063098208D7@microsoft.com...
> Hello All:
> I have a custom template running in word . The users input is stored and
> retrieved from a INI file residing on the user's computer and the method 
> of
> writing and reading form the INI file was to use 
> system.privateprofilestring.
> This worked perfectly in word 2003 and now in word 2007 I get an error
> message for this method. I am using windows xp professional. Can anyone 
> shed
> some light on how I can fix this? Any help would be greatly appreciated.
>
> Thanks,
> Manju.
>

Hi Manju

I've found System.PrivateProfileString to be unreliable all the way back to 
Office 97. I use Karl Petersons kpINI class module instead. Faster, more 
reliable and more capabilities. And Free!

http://vb.mvps.org/samples/project.asp?id=kpIni


-- 
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
date: Fri, 9 May 2008 18:06:50 +0100   author:   Jonathan West

RE: System.Privateprofilestring   
Hello everybody,

I just encountered the same problem when running a 2003 application on 2007. 
The file with all the entries ist definitely there. Read the file works fine, 
but trying to update an entry causes an error every time. As I am running the 
stuff on VISTA could it be that some Vista system protection service prevents 
the program to write a file in the Windows directory?

Any help would bei greatly appreciated.

Thanks, Joern.
-- 
Jörn Schramm
IT-Dienstleistungen
Gutenbergstraße 31
88348 Bad Saulgau
www.joernschramm.de


"Manju" wrote:

> Hello All:
> I have a custom template running in word . The users input is stored and 
> retrieved from a INI file residing on the user's computer and the method of 
> writing and reading form the INI file was to use system.privateprofilestring. 
> This worked perfectly in word 2003 and now in word 2007 I get an error 
> message for this method. I am using windows xp professional. Can anyone shed 
> some light on how I can fix this? Any help would be greatly appreciated.
> 
> Thanks,
> Manju.
>
date: Thu, 3 Jul 2008 05:24:00 -0700   author:   Jörn

Re: System.Privateprofilestring   
"Jörn"  wrote in message 
news:56432594-0A18-44FD-882D-7947C4C84B25@microsoft.com...
> Hello everybody,
>
> I just encountered the same problem when running a 2003 application on 
> 2007.
> The file with all the entries ist definitely there. Read the file works 
> fine,
> but trying to update an entry causes an error every time. As I am running 
> the
> stuff on VISTA could it be that some Vista system protection service 
> prevents
> the program to write a file in the Windows directory?
>
> Any help would bei greatly appreciated.
>

Unless you have administrator rights, attempts to write to a file in the 
Windows directory will fail. Depending on how it is set up and depending on 
what facilities you uso to write to the file, I believe Vista operates a 
kind of virtualisation, where it creates a copy of a system file somewhere 
else and allows you to write to that instead. How (or indeed whether) it 
manages to work out whether to read from the original file or your local 
copy I have no idea.

The answer is to place the INI file somewhere within the user's profile, 
where the user will always have rights to read & write the file.


-- 
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
date: Thu, 3 Jul 2008 15:01:02 +0100   author:   Jonathan West

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us