SHARE
TWEET

Read from txt file

Johniny Mar 4th, 2020 (edited) 194 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub ReadFromFile()
  2.  
  3. Dim configFile As String
  4. Dim configWhole As String
  5. Dim configArr As Variant 'nebude to fungovat so String https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/data-type-summary
  6.  
  7. configFile = Application.ActiveWorkbook.Path & "\config.txt" 'Application.ActiveWorkbook.Path vráti cestu do zložky aktívneho workbooku
  8.    'alternativa Application.ThisWorkbook.Path vráti cestu ku zložke v ktorej je súbor s týmto makrom
  9. Open configFile For Input As #1 'netusim ako funguje Open+Input+Close :(, viac info na https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/line-inputstatement
  10. configWhole = Input$(LOF(1), 1)
  11. Close #1
  12. configArr = Split(configWhole, vbNewLine) 'https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/split-function
  13.  
  14. End Sub
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top