Posted on 2002-03-14
Last Modified: 2010-05-02
The following code deletes everything from position 22 onwards. Could someone please modify it so that it deletes everything from character 16 BACKWARDS and leaves characters 17 to 21 aligned left on the page?



Do Until EOF(File1)
   Line Input #File1, strLine 'Read Line by Line
   If Len(Trim(strLine)) > 21 Then
       Print #File2, Left(strLine, 21)
       Print #File2, strLine
   End If
Question by:muhammasif
  • 2
LVL 22

Expert Comment

ID: 6866132
print mid$(strLine, 17)

this will print everything starting from character 17 to the end of the string.
LVL 18

Accepted Solution

deighton earned 25 total points
ID: 6866221
Do Until EOF(File1)
  Line Input #File1, strLine 'Read Line by Line
  If Len(Trim(strLine)) > 21 Then
      Print #File2, mid(strLine, 17,5)
  End If
LVL 22

Expert Comment

ID: 6866296
Oops...yeah...I missed that "stop at char 21" part.  Make sure to add the ",5" as deighton shows.

Expert Comment

ID: 6867897

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Controlling which port to download from 4 71
Problem to skip loop 6 55
Macro: print each sheet to pdf using ExportAsFixedFormat 11 41
VBA Shell can't Find Word document 11 77
Introduction While answering a recent question ( in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now