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: 989
Default VBA corrupting Cell A1 in CSV file

I'm not a profesional programmer but I know enough to mess stuff up! I have
a form that will be filled out and there is a submit button on the bottom.
On submit the information is passed to a CSV file. This is my first time
trying to pass info to a CSV. When ever I submit the form, the cell a1 on
ends up being 255 # signs. I'll attach my code, I'm hoping someone can shed
some light on thi for me.
------------------------------------------------------------------------------------------
Private Sub CommandButton2_Click()
'Submits information entered into form to master escalation list

Application.ScreenUpdating = True

Dim workingdir As String
Dim Workingfilename As String
Dim workinglocation As String
Dim escnum As String
Dim cnt As String
Dim RngMax As Variant

workingdir = "\\rci.rogers.ca\dfsdata\rss\bu 03\resp 7077\dept
200\Leadership Team\Cable Specific\Mark's Templates & Reports\Escalation
Project\"
Workingfilename = "master.csv"
workinglocation = workingdir & Workingfilename

If IsFileOpen(workinglocation) = True Then

MsgBox ("The file is in use, wait a moment and try again.")
Exit Sub

Else

'On Error Resume Next

Workbooks.Open (workinglocation)

'Application.Wait (Now() + TimeValue("0:00:05"))

a = 2
cnt = 1

If Cells(1, 1) < "" Then

Do While ActiveSheet.Cells(a, 1) < ""
a = a + 1
cnt = cnt + 1
Loop

End If

RngMax = WorksheetFunction.Max(Range(Cells(1, 1), Cells(cnt, 1)))

escnum = 20080000 + cnt

If escnum < RngMax Then
escnum = RngMax + 1
End If

Cells(a, 1) = escnum

Cells(a, 2) = Now()
Selection.NumberFormat = "d-mmm-yy h:mm;@"
Cells(a, 3) = CxName
Cells(a, 4) = AcctNum
Cells(a, 5) = PriNum
Cells(a, 6) = AltNum
Cells(a, 7) = CBTime
Cells(a, 8) = Dept
Cells(a, 9) = askfs
Cells(a, 10) = FSName
Cells(a, 11) = EscDets
Cells(a, 12) = "Pending"

'escmemo = Cells(a, 1)

Workbooks("master.csv").Close (True)

Escalation_Form.Hide

MsgBox ("Your Escalation has been sent " & "Escalation number: "
& escnum)

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
.TMP files are corrupting my folders Ed Excel Discussion (Misc queries) 2 February 8th 08 02:08 PM
Combo box corrupting VLookup function lia Excel Discussion (Misc queries) 1 March 7th 07 09:09 PM
Formatting corrupting the workbook MSweetG222 Excel Programming 1 July 14th 06 06:02 PM
VB Corrupting Pivot Tables RestlessAde Excel Discussion (Misc queries) 3 August 6th 05 01:52 PM
Corrupting a Cell Stumpy Excel Programming 3 May 27th 04 06:42 PM


All times are GMT +1. The time now is 01:28 AM.

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"