S
Striker
I have never used VB, so sorry for the novice questions. I have a very
small app in vba that only uses excel as a place to put a button and some
code that I need to move to VB. Now it seems soemone who uses it does not
have access to excel.
In the following code the application causes some problems in VB. and the
cursor xlwait also causes some problems. I wonder if someone can help me
convert this to a actual VB application. Also maybe a silly question, but I
have been told that if I compile this on a Windows XP machine, it may only
work on an XP machine and not a windows 2000 machine. Is this true, and if
so is there anything I can do to make it work on both operating systems?
Thank You
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sub Open_Write_File()
Dim sLineOfText As String
Dim sFile1 As String
Dim sFile2 As String
Dim iInt As Integer
'set cursor to let user know I'm working.
'Application.Cursor = xlWait
'MsgBox "First lets pick the file you want to remove phone numbers from",
vbOKOnly
sFile1 = Application.GetOpenFilename("Text Files (*.txt), *.txt",
Title:="PICK THE FILE TO REMOVE PHONE NUMBERS FROM")
MsgBox "OK, now lets pick a file name you want to save the new fils as",
vbOKOnly
sFile2 = Application.GetSaveAsFilename("Text Files (*.txt), *.txt",
Title:="CREATE NEW FILE WITHOUT TELEPHONE NUMBERS")
Open sFile1 For Input As 1
Open sFile2 For Output As 2
iInt = 0
Do Until EOF(1)
Line Input #1, sLineOfText
sLineOfText = Trim(Mid(sLineOfText, 1, 729))
Print #2, sLineOfText
iInt = iInt + 1
Loop
Close #1, #2
'return cursor to normal
Application.Cursor = xlDefault
MsgBox iInt & " records updated without phone numbers", vbOKOnly
End Sub
small app in vba that only uses excel as a place to put a button and some
code that I need to move to VB. Now it seems soemone who uses it does not
have access to excel.
In the following code the application causes some problems in VB. and the
cursor xlwait also causes some problems. I wonder if someone can help me
convert this to a actual VB application. Also maybe a silly question, but I
have been told that if I compile this on a Windows XP machine, it may only
work on an XP machine and not a windows 2000 machine. Is this true, and if
so is there anything I can do to make it work on both operating systems?
Thank You
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sub Open_Write_File()
Dim sLineOfText As String
Dim sFile1 As String
Dim sFile2 As String
Dim iInt As Integer
'set cursor to let user know I'm working.
'Application.Cursor = xlWait
'MsgBox "First lets pick the file you want to remove phone numbers from",
vbOKOnly
sFile1 = Application.GetOpenFilename("Text Files (*.txt), *.txt",
Title:="PICK THE FILE TO REMOVE PHONE NUMBERS FROM")
MsgBox "OK, now lets pick a file name you want to save the new fils as",
vbOKOnly
sFile2 = Application.GetSaveAsFilename("Text Files (*.txt), *.txt",
Title:="CREATE NEW FILE WITHOUT TELEPHONE NUMBERS")
Open sFile1 For Input As 1
Open sFile2 For Output As 2
iInt = 0
Do Until EOF(1)
Line Input #1, sLineOfText
sLineOfText = Trim(Mid(sLineOfText, 1, 729))
Print #2, sLineOfText
iInt = iInt + 1
Loop
Close #1, #2
'return cursor to normal
Application.Cursor = xlDefault
MsgBox iInt & " records updated without phone numbers", vbOKOnly
End Sub