J
Jack_Feeman
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
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