This message typically indicates that a VBA run-time error occurred but there was no ON ERROR GOTO statement present to handle it. Put error handling code in place and write the Err object properties to a disk file to diagnose.
HI guys,
We are going on production and facing problem in configuring shared drive for BCA.i created a custom macro when i publish through BCA for saving docs in shared drive it is giving
(303) with no ErrorHandler with BreakOnVBAError=FALSE;
when i include the errorhandler it isnot giving any error but it is nt writing to shared drive but it is saying run successfully.
Hi Jai,
Attaching the macro which iam using to copy to shared drive
Option Explicit
Sub FilterAndExport()
Dim mydoc As Document
Dim myrpt As Report
Dim myFilterVar As DocumentVariable
Dim i, intNumChoices As Integer
Dim myFilterChoices As Variant
Dim strNextValue As String
Dim LOC As String
' -- Creating new folder
'Creating a Seperate new folder for every month and Every Day
Dim Dated, DateStr, DateStr2, VPath, VPath1, VPath_Regions
Dated = CVar(Date)
DateStr = CStr(Format(Dated, "mm-dd-yy"))
DateStr2 = CStr(Format(Dated, "yyyy-mm"))
VPath = "S:\Reports\" & DateStr2
VPath1 = VPath & "\" & DateStr
If Dir(VPath, vbDirectory) = "" Then
MkDir (VPath)
MkDir (VPath1)
End If
'Check if directory exist
If Dir(VPath, vbDirectory) = "" Then
MkDir (VPath)
End If
' Folder created
LOC = VPath1
' Active (open) Document
Set mydoc = ActiveDocument
' Active (with focus) Report
Set myrpt = ActiveReport
' Put your variable (or query object) here
Set myFilterVar = mydoc.DocumentVariables("Resort")
' find out how many resort values there are
intNumChoices = UBound(myFilterVar.Values(boUniqueValues))
' collect the number of choices in a variant variable
myFilterChoices = myFilterVar.Values(boUniqueValues)
For i = 1 To intNumChoices
' Get the variable value
strNextValue = myFilterChoices(i)
' build filter
myrpt.AddComplexFilter myFilterVar, "=<Resort> = " & """" & strNextValue & """"
' recompute the report
myrpt.ForceCompute
' now export to desired format, using the filter value as part of the name
myrpt.ExportAsExcel (LOC & "\" & strNextValue & ".xls")
Next i
' now, unless I can find a RemoveComplexFilter function, this line is used
' to invoke a filter that is always true.
myrpt.AddComplexFilter myFilterVar, "=(1=1)"
myrpt.ForceCompute
End Sub
First suggestion… remove the call to the “S:” drive and replace it with UNC instead. In other words, if the “S” drive is mapped from a server called “Shared” then use \Shared\Path to address the output path instead. When code is run via BCA there are no mapped drives.