Results 1 to 2 of 2

Thread: Solved, OP can delete it. Export part of excelsheet automatically

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2006
    Posts
    1

    Solved, OP can delete it. Export part of excelsheet automatically

    HI, all, I tried to export part of the excel sheet to a text file. I used the folowing code, With Application.GetSaveAsFilename(), someone has to click on the "SAVE" button in the pop-up window. Is there a way I can save the text file without the click?

    Thank you very much.

    Public Sub Dotheexport()
    Dim FName As Variant
    Dim Sep As String

    FName = Application.GetSaveAsFilename("C:\Documents and Settings\xyz\Desktop\Data.txt")


    If FName = False Then
    MsgBox "You didn't select a file"
    Exit Sub
    End If

    Sep = " "
    'Sep = InputBox("Enter a single delimiter character (e.g., comma or semi-colon)", _
    "Export To Text File")

    ExportToTextFile CStr(FName), Sep, _
    False
    End Sub
    Last edited by hufada; Jun 19th, 2006 at 10:31 AM.

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Solved, OP can delete it. Export part of excelsheet automatically

    what do u want to trigger the event?

    in "ThisWorkbook" drop this code in.. u can hit some other events to trigger it
    VB Code:
    1. Dim WithEvents SHT As Worksheet
    2.  
    3.  
    4. Private Sub SHT_Activate()
    5.  
    6. End Sub
    7.  
    8. Private Sub SHT_Calculate()
    9.  
    10. End Sub
    11.  
    12. Private Sub SHT_Change(ByVal Target As Range)
    13.  
    14. End Sub
    15.  
    16. Private Sub SHT_SelectionChange(ByVal Target As Range)
    17.  
    18. End Sub
    19.  
    20. Private Sub Workbook_SheetActivate(ByVal Sh As Object)
    21.     Set SHT = Sh
    22. End Sub
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width