Re: Auto_new VBA to autoname a document and autosave to a specific



Thanks Russ, I will.
I have our VBA programmer looking at it also.
It runs fine from my computer but the error is received when someone opens
the same document from the same web server on their machines. So it is
natural to think it has something to do with permissions. registry or IE
settings.
Thanks
Jack

"Russ" wrote:

Jack,
I realize now that you weren't using PrivateProfileString to write to the
Window's Registry. You were using a file, not a registry key.

I am not familiar with using SharePoint or a document server.

You say that it errors when coming across the first PrivateProfileString
line in the code, which appears to be a read file attempt? Can others use
PrivateProfileString to write and read their own files from their end?

Googling the error numbers you posted yields information mostly concerning
databases and connecting to them. For example:
========Quote
Connectivity Problems for Error 80004005

Firstly, the error 80004005 may be 'by design' in that the database has been
locked by another process or user and therefore cannot accept a connection
at this time.

Causes of Connectivity related Problems

As with all 80004005, I would start with permissions. You may get a good
clue such as 'Login Failed' or [ODBC Microsoft SQL Driver] Logon Failed().

When a database is on a different server from the Web server. Sometimes the
problem is using a UNC path to reference a database. One nasty problem
with UNC paths is that even if the database is on the same computer as the
Web server, the Web server assumes that the database resides on a different
computer.
==========UnQuote

This is related to ASP and non-database error issues:
http://www.aspfaq.com/show.asp?id=2413

If you come across the solution, please share it with the forum.

Jack,
PrivateProfileString writes to the local Windows OS registry. Could it be
that the other people don't have sufficient privileges to change their
Windows Registry? Or your macro, since it is owned by you, can't change
their Registry?

Also to see other methods to store information after a macro ends, go to VBA
help and search on the word 'storing'.


Word 2003
I have accomplished most of what I needed to do already but one more issue.
I have a Word document that is stored on a SharePoint site as a template (but
still a .doc) file. An auto_new sub is started to bookmark a place in the
document and auto-name the document based on an external text document that
tracks the last used filename and renames the document sequentially and saves
it back to the SharePoint site as that sequential filename. It was absolutely
great on my machine when the external file is stored/access on a network
share. I tried storing the external file in the same directory on the site
but that doesn't work. When others try it on their computers (Word 2003), the
document opens but they get an error msg that says: Run-Time Error
'-2147467259(80004005)': Method 'PrivateProfileString' of object 'System'
failed
My code is:
Private Sub Document_New()
' Unprotect document to run macro
ActiveDocument.Unprotect

Order = System.PrivateProfileString("\\Northstar\headquarters\Departmental
Folders\TWG\ECN.txt", _
"MacroSettings", "Order")
'Order = System.PrivateProfileString("http://docrep/vmc/ecn/ECN.txt";, _
'"MacroSettings", "Order")
If Order = "" Then
Order = 1
Else
Order = Order + 1
End If

System.PrivateProfileString("\\server\share\dir\subdir\ECN.txt",
"MacroSettings", _
"Order") = Order

'System.PrivateProfileString("http://servername/site/subsite/ECN.txt";,
"MacroSettings", _
'"Order") = Order

ActiveDocument.Bookmarks("Order").Range.InsertBefore _
Format(Order, "00#") & "-" & Format(Now, "YY")
'ActiveDocument.SaveAs FileName:=Format(Order, "00#") & "-" & Format(Now,
"YY")
' Re-protect document for Forms after running macro
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
' Save ECN with ECN number for file name and in the ECN library
ActiveDocument.SaveAs FileName:="http://docrep/vmc/ecn/ChangeRequests/"; & _
Format(Order, "00#") & "-" & Format(Now, "YY")

End Sub
Any ideas why is errors on all others machine but not on mine.
Thanks
Jack

--
Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID


.



Relevant Pages

  • Re: Auto_new VBA to autoname a document and autosave to a specific pat
    ... not a registry key. ... You say that it errors when coming across the first PrivateProfileString ... When a database is on a different server from the Web server. ...
    (microsoft.public.word.vba.general)
  • Re: Re: Need info, books, articles,code, etc: Access VBA to XML to/from MySQL via HTTP
    ... read, update, add and delete records located in tables in a MySQL database ... on a Web server on the Internet directly from my desktop Access application, ... the workstation needs a secure shell client running in order to enable the ... the MySQL database on your workstation ...
    (comp.databases.ms-access)
  • Re: My library is gone! "There are no items in this library yet"
    ... Also, FWIW I just tried to reproduce the registry failure below, but I couldn't get the bad behavior that I saw earlier. ... I had begun to formulate an opinion that rebuilding the database does not only fix a corrupted database but also could fix other configuration and settings. ... If there was a way to get this to the Windows Media Player product team, it could help in troubleshooting the high number of reportedly corrupt databases. ... WMP11 isn't letting itself access or create any libraries, ...
    (microsoft.public.windowsmedia.player)
  • Re: Re: Need info, books, articles,code, etc: Access VBA to XML to/from MySQL via HTTP
    ... Can the Access database application be co-located with the MySQL database on ... Which Web server is being used? ... a slightly complex problem pops up, the spoon-fed developer is going to be ...
    (comp.databases.ms-access)
  • Re: TNS could not resolve the connect identifier
    ... database driver. ... Who supports and configures the database drivers on your production web ... The provider name is System.Data.OleDb. ... The web application does not work on the production web server. ...
    (comp.databases.oracle.server)