path can't find if the path is in network

mark692

Active Member
Joined
Feb 27, 2015
Messages
321
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,
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
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
 
Upvote 0
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

qJAtm
qJAtm
 
Upvote 0
so is it fixed by taking the extra spaces out ?
 
Upvote 0

Forum statistics

Threads
1,214,787
Messages
6,121,565
Members
449,038
Latest member
Guest1337

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top