Help PLEASE

S

Sarah_Lecturer

I have some code - which until today - was working perfectly:

Sub AddPONo()

Order = System.PrivateProfileString("\\server\dept$\IT\New Purchase
Orders\Settings.Txt", _
"MacroSettings", "Order")

If Order = "" Then
Order = 508
Else
Order = Order + 1
End If

System.PrivateProfileString("\\server\dept$\IT\New Purchase
Orders\Settings.txt", "MacroSettings", _
"Order") = Order

ActiveDocument.Bookmarks("Order").Range.InsertBefore Format(Order, "IT00000#")
ActiveDocument.SaveAs FileName:="\\server\dept$\IT\New Purchase Orders\" &
Format(Order, "IT00000#")

End Sub

When I run the code I get an error message :

System Error &H0004005 (-2147467259)

Any suggestions would be fantastic!

Thanks in advance for your help

Sarah xx
 
T

Tobias Schröer

Hi,

Sarah_Lecturer said:
I have some code - which until today - was working perfectly:

Sub AddPONo()

Order = System.PrivateProfileString("\\server\dept$\IT\New Purchase
Orders\Settings.Txt", _
"MacroSettings", "Order")

If Order = "" Then
Order = 508
Else
Order = Order + 1
End If

System.PrivateProfileString("\\server\dept$\IT\New Purchase
Orders\Settings.txt", "MacroSettings", _
"Order") = Order

ActiveDocument.Bookmarks("Order").Range.InsertBefore Format(Order, "IT00000#")
ActiveDocument.SaveAs FileName:="\\server\dept$\IT\New Purchase Orders\" &
Format(Order, "IT00000#")

End Sub

When I run the code I get an error message :

System Error &H0004005 (-2147467259)

Any suggestions would be fantastic!

Thanks in advance for your help

Sarah xx

have you used Google for some research? One result points to a possible
access error when saving the file. Is the share you use still available?
In which code line does the error occur?

Tobi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top