external file counter

L

l1075

I have a macro in which the user will generate a packing slip. Thi
macro is available on three machines which all have access to a networ
drive. (L:). I want to have a txt file on this drive with a intege
value and whenever the packing slip macro is run, it will take thi
value from this file, increment it by one, and then save it. I don'
know if this is possible because of sharing violations or having tw
macros running at the same time. I have looked around and havent bee
able to find any code for an external file counter. Any example code o
even a link to information concerning this would be great
thank
 
L

l1075

Sub GetDataFromClosedWorkbook()
Dim wb As Workbook
Application.ScreenUpdating = False ' turn off the screen updating
Set wb = Workbooks.Open("L:\Foldername\Filename.xls", True, True)
' open the source workbook, read only
Dim Counter As Integer

With ThisWorkbook.Worksheets("TargetSheetName")
' read data from the source workbook
Counter = wb.Worksheets("Worksheet1").Range("A10").Formula
Counter = Counter + 1

End With
wb.Close False '

Set wb = Nothing ' free memory
Application.ScreenUpdating = True ' turn on the screen updating

End Sub

This current code does not save the changes, I want to be able to sav
the sourceworkbook

thank
 

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