Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 10th, 2004, 06:34 AM
Registered User
 
Join Date: Jan 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Excel Increment Problem

Hi there!

I have got a really enoying problem with increment a number out of a text file into excel and use this number to send it as a number in the subject of an email.

Here is my code:

Private Sub LOV_Click()
If MsgBox("Send it?", vbOKCancel) = vbOK Then

Cells.Select
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveWorkbook.SaveAs FileName:="C:\LOV.xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWorkbook.SendMail Recipients:="mail@mail.com", _
Subject:="Something" & "-" & Range("C1").Value & "-" & "IncrementNr" & "-" & "LOV"
ActiveWorkbook.Close True
Dim KillFile As String
KillFile = "c:\LOV.xls"
If Len(Dir$(KillFile)) > 0 Then
SetAttr KillFile, vbNormal
Kill KillFile
End If
End If

End Sub

The thing is, to differntiate between the excel files, the users are going to send to me, i would like to make use of a txt.file from which excel is getting a specified number e.g. user1 is sending this file, excel looks in the txt file before sending, excel sees that the number is for example 5, excel writes number 6 into the txt file, and uses it in the subject, so that I know which of the excel files are the newest. It doesn't matter if two Users are working at the same time with the excel file. User2 would increment number 7 and send the number 7 in the subject of the email. Puuhh....hard work, isn't it? It is no problem to implement a number from Excel into the subject for me. but what can I do to tell excel to read the txt file than increment the number in the text file, take that number and copy it to specified range in the excel sheet to "vba" it into the subject?

How can I do this? Any reply is greatly appreciated!!

Jim


 
Old February 20th, 2004, 11:52 AM
Authorized User
 
Join Date: Feb 2004
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Still having this problem?

Dave





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Increment Operators alexdelamuerte BOOK: Beginning JavaScript 3rd Ed. ISBN: 978-0-470-05151-1 2 December 3rd, 2008 11:51 AM
Auto Increment Field Problem in SQL Server 2000 yes_no ASP.NET 1.0 and 1.1 Professional 4 August 11th, 2008 07:10 AM
Problem in opening excel file in MS Excel 2000 kallol Visual C++ 0 November 16th, 2007 05:48 AM
Increment a tag stefan.yu XSLT 10 April 16th, 2007 05:45 AM
Auto increment prad_a MySQL 3 April 7th, 2007 05:47 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.