L
ldiaz
I'm running a macro from a Form in access but now it's showing an error
Error "1004" = Cannot Access CurrentDispatch.xls in the excel code
I click End and then appear other error in my Access code.
and then "440" in Acc
the macro file is located in a shared drive \\asdec\\ss$
("B:\Shipment System DB\Shipment System\Utilities\")
but it open another file that is located in the same shared drive \\asdec\\ss$
"B:\Shipment System DB\Shipment System\Current Dispatch File"
please help.....
this is the code in my excel macro
... to open another file named: CurrentDispatch.xls
=================================================
ChDir "B:\Shipment System DB\Shipment System\Current Dispatch File"
Workbooks.Open Filename:= _
"B:\Shipment System DB\Shipment System\Current Dispatch
File\CurrentDispatch.xls"
=================================================
and this is my code on my form
==============================================
Private Sub RunEMac_Click()
Dim xls As Object, xwkb As Object
Dim strFile As String, strMacro As String
strFile = "ShippingMacro.xls"
strMacro = "Shipping"
Set xls = CreateObject("Excel.Application")
xls.Visible = True
Set xwkb = xls.Workbooks.Open("B:\Shipment System DB\Shipment
System\Utilities\" & strFile)
xls.Run strFile & "!" & strMacro
xwkb.Close False
Set xwkb = Nothing
xls.Quit
Set xls = Nothing
End Sub
==============================================
Error "1004" = Cannot Access CurrentDispatch.xls in the excel code
I click End and then appear other error in my Access code.
and then "440" in Acc
the macro file is located in a shared drive \\asdec\\ss$
("B:\Shipment System DB\Shipment System\Utilities\")
but it open another file that is located in the same shared drive \\asdec\\ss$
"B:\Shipment System DB\Shipment System\Current Dispatch File"
please help.....
this is the code in my excel macro
... to open another file named: CurrentDispatch.xls
=================================================
ChDir "B:\Shipment System DB\Shipment System\Current Dispatch File"
Workbooks.Open Filename:= _
"B:\Shipment System DB\Shipment System\Current Dispatch
File\CurrentDispatch.xls"
=================================================
and this is my code on my form
==============================================
Private Sub RunEMac_Click()
Dim xls As Object, xwkb As Object
Dim strFile As String, strMacro As String
strFile = "ShippingMacro.xls"
strMacro = "Shipping"
Set xls = CreateObject("Excel.Application")
xls.Visible = True
Set xwkb = xls.Workbooks.Open("B:\Shipment System DB\Shipment
System\Utilities\" & strFile)
xls.Run strFile & "!" & strMacro
xwkb.Close False
Set xwkb = Nothing
xls.Quit
Set xls = Nothing
End Sub
==============================================