VBA EXCEL: Fixing "Runtime-error '9'": Subscript out of range -


I have the following code that attempts to open a file name that changes on a daily basis if the sheet is empty Name is always named:

  • "K: \ Shared \ Num \ Temp \ available_list_" & amp; Year (now ()) & amp; Month (now ()) & amp; Day (now ()) & amp; ".txt"

To automate file activation instead of copying, pasting, and renaming the file every time I got this error when I included the above path Updated code for Can anyone tell me where my error is? You can find the following code:

  Personal sub UserForm_Initialize () Application.ScreenUpdating = False IfEmpty (A_Regular.Range ("A2")) then the dim TxtPath, TxtName as string TxtPath = " K: \ Shared \ Num \ Temp \ available_list_ "& amp; Year (now ()) & amp; Month (now ()) & amp; Day (now ()) & amp; ".txt" TxtName = year (now ()) & amp; Month (now ()) & amp; Day (now ()) & amp; ".txt" workbook OpenText file name: = TxtPath, Origin: = 437, StartAvar: = 1, _DataType: = XL Delimited, TextQuality: = XLD double quat, consecutive delimiter: = wrong, _tab: = true, semicolon: = false, comma: = Wrong, space: = wrong, _ other: = true, other field: = ",", fieldInfo: = array (arrays (1, 1), _array (2, 1), array (3, 5), array 4, 1), Array (5, 1)), trailing minas number: = truth '------------------------------ - ------------------------------------------ '' Setup Sheet '' - ---------------------------------------- ---------- --------------------- 'Workbook with (TCTNM)' ----------- ----------- --------------------------------------- ----------- - '' Demand Total, Follows = Tollfields as Double Total Refrigerator = Applications. Worksheet Function. Contif (range ("D: D"), "free" range ("A1: E" and total free). Termination with workbooks ("Matt.") Activate activation. Enabled = true activation Active Paste Special Range with Ra ("1: 1"). Shift: = xlDown, CopyOrigin: = xlFormatFromLeftOrAbove Range ("A1") = "GSM" Category ("B1") = "Type" Category ("C1") = "Date" Category ("D1") Call encryption ends with the "Status" category ("E1") = "Number" category ("F1") = "Pattern" activation. Cells.Clear Windows (TxtName) Close the control. Activate activation. Visible = incorrect if the application ends. WindowState = xlMinimized number management Show End End <= "Text"> 

You open a file named "available_list_"; Year (now ()) & amp; Month (now ()) & amp; Day (now ()) & amp; ".txt" (filename without path) but you try to reference the letter by year (now ()); Month (now ()) & amp; Day (now ()) & amp; ".txt" without available_list . The worksheet does not exist with this name of the course.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Algorithm negotiation fail SSH in Jenkins -

java - Messages from .properties file do not display UTF-8 characters -