A family of Microsoft word processing software products for creating web, email, and print documents.
Thanks, will check that out.
Kevin
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
I've created a raffle ticket numbering system where I've set 2 bookmarks on each side of a raffle ticket so that the numbers can be matched later in a draw.
I use PrivateProfileString twice in the macro once to read the incoming value
SerialNumber = System.PrivateProfileString("C:\Settings.Txt", "MacroSettings", "SerialNumber")
which works fine (ie it gets the number) and the 2nd time to write the last number back to the file (so if I need extra the last count is already there). Everything works fine except that when it gets to writing the last number to the file (Settings.txt just like in the example)
System.PrivateProfileString("C:\Settings.txt", "MacroSettings", "SerialNumber") = SerialNumber1
It give the error box "Run-time error '-2147467259 (80004005)': Method 'PrivateProfileString' of object 'System' failed". And yes, SerialNumber1 is a real number - I walked thru the debug step by step. I thought it might be some permission thing with Win 7 (running word 2010) but I gave full access and still the same thing. Help!
Thanks, Kevin
A family of Microsoft word processing software products for creating web, email, and print documents.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Thanks, will check that out.
Kevin
Try using the GetSetting and SaveSetting methods. Check out the help in the Visual Basic Editor for the syntax.
-- Hope this helps.
Doug Robbins - Word MVP,
dkr[atsymbol]mvps[dot]org
Posted via the Community Bridge
"kam5FCC" wrote in message news:*** Email address is removed for privacy ***...
Hi,
I've created a raffle ticket numbering system where I've set 2 bookmarks on each side of a raffle ticket so that the numbers can be matched later in a draw.
I use PrivateProfileString twice in the macro once to read the incoming value
SerialNumber = System.PrivateProfileString("C:\Settings.Txt", "MacroSettings", "SerialNumber")
which works fine (ie it gets the number) and the 2nd time to write the last number back to the file (so if I need extra the last count is already there). Everything works fine except that when it gets to writing the last number to the file (Settings.txt just like in the example)
System.PrivateProfileString("C:\Settings.txt", "MacroSettings", "SerialNumber") = SerialNumber1
It give the error box "Run-time error '-2147467259 (80004005)': Method 'PrivateProfileString' of object 'System' failed". And yes, SerialNumber1 is a real number - I walked thru the debug step by step. I thought it might be some permission thing with Win 7 (running word 2010) but I gave full access and still the same thing. Help!
Thanks, Kevin
Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org