Computer Forum Forum Index
Register  FAQ Profile Log in to check your private messages Log in Register 

Word VBA on a web server

 
Post new topic   Reply to topic    Computer Forum Forum Index -> microsoft word programming
View previous topic :: View next topic  
Author Message
Jack_Feeman
Guest





PostPosted: Wed Dec 05, 2007 8:52 pm    Post subject: Word VBA on a web server Reply with quote

Help: I am using a word template in an Intranet environment. The template is
opened from the web server and vba assigns an unique number from a variable
contained in a text file located on the web server. This works great on my
machine. When another user (with permissions to the areas of the web server)
tries to open the template, they get an error msg stating: Method
'PrivateProfileString' of object 'System' failed. It was explained that this
was writing to the registry and when others were using it there was a
security issue writing to their registry.

This is a great piece of code, however, I need others to use it as well. The
template is looking for the text file to get the next sequential number. Is
it really necessary to query/write the registry to do this? Is there another
way to do this that doesn't require writing to the registry?

Here is the code I am using:
Quote:
Private Sub Document_New()
' Unprotect document to run macro
ActiveDocument.Unprotect

Order =
System.PrivateProfileString("http://server/directory/subdirectory/ECN.txt", _
"MacroSettings", "Order")
If Order = "" Then
Order = 1
Else
Order = Order + 1
End If

System.PrivateProfileString("http://server/dir/subdir/ECN.txt",
"MacroSettings", _
"Order") = Order

ActiveDocument.Bookmarks("Order").Range.InsertBefore _
Format(Order, "00#") & "-" & Format(Now, "YY")
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True

End Sub
Unquote

Thanks
Jack
Back to top
Google
Sponsor





PostPosted: Wed Dec 05, 2007 8:52 pm    Post subject: Advertisement

Back to top
Display posts from previous:   
Post new topic   Reply to topic    Computer Forum Forum Index -> microsoft word programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Computer Forum