Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-10-2013, 06:55 PM
lbf200n lbf200n is offline Invoice number sync from different location? Windows 7 64bit Invoice number sync from different location? Office 2007
Novice
Invoice number sync from different location?
 
Join Date: Dec 2012
Posts: 3
lbf200n is on a distinguished road
Default 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
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Invoice number sync from different location? 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 sync from different location? Invoice Number Generation mrphilk Excel 2 06-08-2010 12:39 PM
Invoice number sync from different location? change currency $ to £ on excel invoice help deanorx7 Excel 3 07-08-2008 04:40 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:57 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft