LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Reading File and adding contents to spreadsheet

I need to read a number (counter) from a file (.txt probably), and add it to
my spreadsheet. Then increment that number by one, and store the result back
into the file. The purpose is so different users can open the spreadsheet
and get the next available number to number the form. Here's how I did it in
Word. How do I do it in Excel?

Public Sub MAIN()
Dim CheckNum$
Dim docnum$
CheckNum$ = WordBasic.[GetFormResult$]("DocNumField")
If CheckNum$ = "00000" Then
docnum$ = WordBasic.[GetPrivateProfileString$]("DocTracker", "DocNum", _
"U:\Counter\TemplateCounter.INI")
docnum$ = Str((WordBasic.Val(docnum$) + 1))
WordBasic.SetFormResult "DocNumField", docnum$
WordBasic.SetPrivateProfileString "DocTracker", "DocNum", docnum$, _
"U:\Counter\TemplateCounter.INI"
ActiveWindow.ActivePane.HorizontalPercentScrolled = 34
End If
End Sub


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading contents Fiona Excel Discussion (Misc queries) 3 June 28th 07 02:56 AM
Reading Contents of a Directory Nigel Excel Programming 2 December 5th 05 05:57 PM
reading contents of a file Christopher Brooks[_3_] Excel Programming 2 June 14th 04 09:06 PM
Browsing to URL and reading contents Mike[_49_] Excel Programming 9 November 20th 03 07:53 PM


All times are GMT +1. The time now is 07:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"