Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Code to delete a Line in a another code


Hi there

Is there a code to Delete a specific line within a VBA Code or withi
another vba code within the same VBAProject ?


Code
-------------------
Sub ChkFileExists()
Dim fs
Dim StrFileName As String

Set fs = CreateObject("Scripting.FileSystemObject")
StrFileName = "C:\Gaber1314.txt"
If fs.FileExists(StrFileName) Then
MsgBox "File Already exixsts", vbInformation, "Execution interrupted"
Else
MsgBox "File Does Not exixsts", vbCritical, "Execution interrupted"
End If

'*I want to delete this line only, using another code in the same VBAProject
Application.Run "Createtxt"

End Sub
-------------------


i looked at :
Pearson Software Consulting, LLC
Programming To The Visual Basic Editor
http://www.cpearson.com/excel/vbe.htm

but could not find waht i need

--
helmekk

-----------------------------------------------------------------------
helmekki's Profile: http://www.excelforum.com/member.php...nfo&userid=693
View this thread: http://www.excelforum.com/showthread.php?threadid=39370

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default Code to delete a Line in a another code

helmekki,

How about another way around the problem?

In a spare cell (say Z99) put "Run"

Sub ChkFileExists()
"
"
"
"
If Range("Z99").Value = "Run" Then
Application.Run"Createtxt"
End If
"
"
"
End Sub

Elsewhere, where you wanted to delete the line, put

Range("Z99").Value = ""

Now that line will run until you change the value in Cell Z99.
It won't be deleted, but it will never be executed again.

Henry


"helmekki" wrote in
message ...

Hi there

Is there a code to Delete a specific line within a VBA Code or within
another vba code within the same VBAProject ?


Code:
--------------------
Sub ChkFileExists()
Dim fs
Dim StrFileName As String

Set fs = CreateObject("Scripting.FileSystemObject")
StrFileName = "C:\Gaber1314.txt"
If fs.FileExists(StrFileName) Then
MsgBox "File Already exixsts", vbInformation, "Execution interrupted"
Else
MsgBox "File Does Not exixsts", vbCritical, "Execution interrupted"
End If

'*I want to delete this line only, using another code in the same
VBAProject
Application.Run "Createtxt"

End Sub
--------------------


i looked at :
Pearson Software Consulting, LLC
Programming To The Visual Basic Editor
http://www.cpearson.com/excel/vbe.htm

but could not find waht i need.


--
helmekki


------------------------------------------------------------------------
helmekki's Profile:
http://www.excelforum.com/member.php...fo&userid=6939
View this thread: http://www.excelforum.com/showthread...hreadid=393708



Reply
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
Macro code to put series name next to individual line in line grap Otani Charts and Charting in Excel 3 February 23rd 10 07:24 PM
VBA line of code executes in Immediate Window but not in Code Window [email protected] Excel Discussion (Misc queries) 2 April 30th 07 02:52 PM
Continue line of VBA code on the next line peacelittleone Excel Programming 9 June 24th 05 07:46 PM
VBA code delete code but ask for password and unlock VBA protection WashoeJeff Excel Programming 0 January 27th 04 07:07 AM
VBA code to delete VBA code in another Workbook Chip Pearson Excel Programming 0 September 15th 03 03:54 PM


All times are GMT +1. The time now is 11:07 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"