Results 1 to 10 of 31

Thread: Test

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    This post is to help me answering here:

    http://www.excelfox.com/forum/showth...2177#post12177





    It is a similar idea as in the last post. The only difference is that the text information is passed via a text file.

    So as before, both files should be downloaded to the same place.
    File "OpenAndRunMeMacros.xls" should be opened and this time the macro Sub MeMacroTextMies() should be run.
    ( You do not need to do anything about the text file. That will be made the first time Sub MeMacroTextMies() is run , and subsequently it will be overwritten by each further run of Sub MeMacroTextMies(). )

    Sub MeMacroTextMies() running should cause "LibroSociTextMies.xls" to be opened, and as before a similar set of events should take place:
    A message box pops up:
    LibroSociTextMiesMsgBox.JPG : https://imgur.com/5sAvqPP
    LibroSociTextMiesMsgBox.JPG


    and then the file "LibroSociTextMies.xls" is modified:
    UseCodeLine2.JPG : https://imgur.com/SKeW4MQ
    UseCodeLine2.JPG





    Coding in "OpenAndRunMeMacros.xls"
    Code:
    Sub MeMacroTextMies()
    Dim NTes As String: Let NTes = "Ciao"
    Dim strcFileName As String: Let strcFileName = "Timer.txt"
    Dim intFile As Long: Let intFile = FreeFile
    Open ThisWorkbook.Path & "\" & strcFileName For Output As #intFile
    Write #intFile, NTes
    Close intFile
     Application.OnTime EarliestTime:=Now(), Procedure:="AggiornaLibroSociTexties"
    End Sub
    Sub AggiornaLibroSociTexties()
    Dim xlapp As Excel.Application
    Dim xlBook As Excel.Workbook
    Dim ExcelPath As String
     Let ExcelPath = ThisWorkbook.Path & "\"  ' CurrentProject.Path & "\"
     Set xlapp = CreateObject("Excel.Application")
     Let xlapp.Visible = True
     Set xlBook = xlapp.Workbooks.Open(ExcelPath & "LibroSociTextMies.xls")
     xlBook.Close
     xlapp.Quit
    
     Set xlBook = Nothing
     Set xlapp = Nothing
    End Sub
    



    Coding in "LibroSociTextMies.xls"
    Code:
    Option Explicit
    Private Sub Workbook_Open()
    Dim intFile As Long: Let intFile = FreeFile
    Dim strcFileName As String: Let strcFileName = "Timer.txt"
    Open ThisWorkbook.Path & "\" & strcFileName For Input As #intFile
    Dim NTes As String
    Input #intFile, NTes
    Close intFile
     MsgBox prompt:=NTes
    Dim xlBook As Workbook
    Dim rowNo As Long
     Set xlBook = ThisWorkbook
     Let rowNo = xlBook.Worksheets("LibroSoci").Range("C:C").Find(What:=NTes, LookIn:=xlValues).Row
     Let xlBook.Worksheets("LibroSoci").Cells(rowNo, 4).Value = Year(Date)
    End Sub
    Attached Files Attached Files
    Last edited by Molly Brennholz; 02-13-2020 at 02:12 AM.

Similar Threads

  1. Test
    By DocAElstein in forum Test Area
    Replies: 0
    Last Post: 03-30-2020, 07:20 PM
  2. test
    By EFmanagement in forum Test Area
    Replies: 0
    Last Post: 09-29-2019, 11:01 PM
  3. This is a test Test Let it be
    By Admin in forum Test Area
    Replies: 6
    Last Post: 05-30-2014, 09:44 AM
  4. Test
    By Excel Fox in forum Word Help
    Replies: 0
    Last Post: 07-05-2011, 01:51 AM

Posting Permissions

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