path can't find if the path is in network

mark692

Active Member
Joined
Feb 27, 2015
Messages
306
Office Version
  1. 2016
Platform
  1. Windows
hi sir i have a code here but when i use the path on network the code can't find it but if i use a path not on network it works fine

Sub Submit() Application.ScreenUpdating = False
Dim wbk As Workbook
Dim Fname As String
Dim pth As String
Dim Addr As String


pth = "\\LIZASOTSSERVER\LizasoTSNetworkFiles\RUBY LULAY Daily Report"
Fname = "Sales Check Online.xlsx"
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=8, Criteria1:= _
">0"
Range("Table1[[Invoice Date]:[Time Date]]").Select
Selection.Copy

Addr = Selection.Address
If Not wbkExists(Fname) Then
Set wbk = Workbooks.Open(pth & Fname)
Else
Set wbk = Workbooks(Fname)
End If

ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Select
Do While ActiveCell = Empty
ActiveCell.Offset(-1, 0).Select
Loop
ActiveCell.Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

''wbk.Sheets("Sales").Range("D5").PasteSpecial
ThisWorkbook.Activate
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=8

ActiveSheet.ListObjects("Table2").Range.AutoFilter Field:=8, Criteria1:= _
">0"
Range("Table2[[Check or Acknowledgement]:[Time Date]]").Select
Selection.Copy

''Range("Table5[QTY]").Copy
Workbooks("Sales Check Online.xlsx").Activate
Worksheets("Payment Receive").Activate

ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Select
Do While ActiveCell = Empty
ActiveCell.Offset(-1, 0).Select
Loop
ActiveCell.Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ThisWorkbook.Activate
ActiveSheet.ListObjects("Table2").Range.AutoFilter Field:=8

wbk.Application.DisplayAlerts = False
wbk.Save
wbk.Close

''Sheets("Input").Activate
''Sheets("Input").Calculate


End Sub


the Bold code is the network path,
 

Some videos you may like

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

mole999

Moderator
Joined
Oct 23, 2004
Messages
10,524
Office Version
  1. 2019
  2. 2016
  3. 2013
Platform
  1. Windows
is it supposed to look like two spaces \ \ rather than \\ can you get that as a path and copy from what works straight into the vba
 

mark692

Active Member
Joined
Feb 27, 2015
Messages
306
Office Version
  1. 2016
Platform
  1. Windows
is it supposed to look like two spaces \ \ rather than \\ can you get that as a path and copy from what works straight into the vba

i coppied it straight from the address bar sir this is the error sir

 

mole999

Moderator
Joined
Oct 23, 2004
Messages
10,524
Office Version
  1. 2019
  2. 2016
  3. 2013
Platform
  1. Windows
so is it fixed by taking the extra spaces out ?
 

Watch MrExcel Video

Forum statistics

Threads
1,114,440
Messages
5,547,928
Members
410,819
Latest member
mendee525
Top