#1
|
|||
|
|||
Invoice number sync from different location?
I have got this code from Leith Ross, thanks Leith.
It can let all my Excel invoices have synchronized invoice number. the txt file with invoice number in it is storing in my hard drive. I have a hosting service that is currently hosting my website. I was trying to upload the invoice number file to the root address of host server and gave it writable to everyone, and change the DefaultPath in the marco to http:\\www.mywebsite.com\InvoiceNum.txt and hoping my excel invoice could access and synchronize the invoice number from different location and different computer, but it didn't work. Where am I doing wrong? or this is not so achievable? Here is the working code on my local computer: Code:
'Written: October 15, 2009 'Author: Leith Ross 'Sumamry: Creates a text file using the file path and name specfied or the defaults ' if the file doesn't exist. This file holds a serial number starting at one ' and is incremented and saved each time the function is called. Function GetSerialNumber(Optional FilePath As String, Optional FileName As String) As String Dim DefaultName As String Dim DefaultPath As String Dim FSO As Object Dim SeqNum As Variant Dim TxtFile As Object DefaultPath = "G:\" DefaultName = "InvoiceNum" FilePath = IIf(FilePath = "", DefaultPath, FilePath) FilePath = IIf(Right(FilePath, 1) <> "\", FilePath & "\", FilePath) FileName = IIf(FileName = "", DefaultName, FileName) FileName = FilePath & IIf(InStr(1, FileName, ".") = 0, FileName & ".txt", FileName) Set FSO = CreateObject("Scripting.FileSystemObject") 'Open the file for Reading and Create the file if it doesn't exists Set TxtFile = FSO.OpenTextFile(FileName, 1, True, 0) 'Read the serial number If Not TxtFile.AtEndOfStream Then SeqNum = TxtFile.ReadLine TxtFile.Close 'Update the serial number Set TxtFile = FSO.OpenTextFile(FileName, 2, False, 0) SeqNum = Format(IIf(SeqNum = "", "1", Val(SeqNum) + 1), "0000") TxtFile.WriteLine SeqNum TxtFile.Close GetSerialNumber = SeqNum Set FSO = Nothing Set TxtFile = Nothing End Function Sub InvoiceNumberDisplay() Sheets(1).Range("J13") = GetSerialNumber() End Sub |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
automatic invoice numbering | acki | Excel | 7 | 08-14-2013 08:11 PM |
Outlook 2007 win7x32 Archive location/backup location question | michael.monaco | Outlook | 0 | 11-19-2012 02:07 PM |
Invoice Statement | Shoshana3 | Word | 0 | 11-15-2010 03:02 PM |
Invoice Number Generation | mrphilk | Excel | 2 | 06-08-2010 12:39 PM |
change currency $ to £ on excel invoice help | deanorx7 | Excel | 3 | 07-08-2008 04:40 AM |