2013-12-17 104 views
-2

我收到此錯誤:「在當前作用域中重複聲明」,但在此作用域或整個項目中沒有重複。請幫我解決這個問題。VBA「重複聲明」錯誤,不重複

Option Compare Database 
Option Explicit 

Public intConstantTableRow As Integer 

Public strOutlookSourceFolder As String 
Public strOutlookSourceFolderPath As String 
Public strAccessTargetFolder As String 
Public strAccessTargetFileName As String 



Sub ImportItems() 

    intConstantTableRow = 2 

    Call GetConstantsFromTable(intConstantTableRow, _ 
          strOutlookSourceFolder, _ 
          strOutlookSourceFolderPath, _ 
          strAccessTargetFolder, _ 
          strAccessTargetFileName) 
End Sub 

Sub GetConstantsFromTable(ByVal intConstantTableRow1 As Integer, _ 
          ByRef strOutlookSourceFolder1 As String, _ 
          ByRef strOutlookSourceFolder1 As String, _ 
          ByRef strAccessTargetFolder1 As String, _ 
          ByRef strAccessTargetFileName1 As String) 
End Sub 
+1

'爲ByRef strOutlookSourceFolder1作爲字符串,'出現了兩次。 – nico

+0

感謝您的援助。 –

回答

2

你聲明的變量兩次

ByRef strOutlookSourceFolder1 As String, _ 
ByRef strOutlookSourceFolder1 As String, _ 

試着這麼做

Sub GetConstantsFromTable(ByVal intConstantTableRow1 As Integer, _ 
          ByRef strOutlookSourceFolder1 As String, _ 
          ByRef strOutlookSourceFolderPath1 As String, _ 
          ByRef strAccessTargetFolder1 As String, _ 
          ByRef strAccessTargetFileName1 As String) 
End Sub