PDA

View Full Version : Solved: Ambigous Name Error



YellowLabPro
10-14-2008, 06:42 AM
I am splitting up a module that calls on several other modules. The original module runs w/out error, however I believe that I am continously getting inconsistent results due to memory issues. To resolve this I am separating the module up into two separate ones. In doing so I have created a new module and placed the "Calls" in there. But I am getting a Compile error: Ambiguous name detected: ImportAttribs. This is the second call instruction, it does not happen w/ the call to a prior module.

Any ideas?


Sub Attribs()
'////////////////////// Timer ///////////////////////////////////////////////
Dim StartTime As Variant, StopTime As Variant, Elapsed As Variant
StartTime = Time
'////////////////////////////////////////////////////////////////////////////

' Dim y, z, a, b, w, x
' Dim wbSource As Workbook
' Dim wsSourceFF As Worksheet, wsSourceVB As Worksheet, wsTarget As Worksheet
' Dim rng1 As Range, rng2 As Range
' Dim lrTarget As Long, numColumns As Long, i As Long, ii As Long, iii As Long
' Dim lngRowCountWSF As Long, lngRowCountWSV As Long, iStatus As Long
' Dim wbn As String, wPath As String
Dim newHour As Double, newMinute As Double, NewSecond As Double, WaitTime As Double

Application.ScreenUpdating = False

newHour = Hour(Now())
newMinute = Minute(Now())
NewSecond = Second(Now()) + 2
WaitTime = TimeSerial(newHour, newMinute, NewSecond)
Application.Wait WaitTime

Call AttribPriceSize

newHour = Hour(Now())
newMinute = Minute(Now())
NewSecond = Second(Now()) + 2
WaitTime = TimeSerial(newHour, newMinute, NewSecond)
Application.Wait WaitTime

Call ImportAttribs

newHour = Hour(Now())
newMinute = Minute(Now())
NewSecond = Second(Now()) + 2
WaitTime = TimeSerial(newHour, newMinute, NewSecond)
Application.Wait WaitTime

Call JoinAttribs

newHour = Hour(Now())
newMinute = Minute(Now())
NewSecond = Second(Now()) + 2
WaitTime = TimeSerial(newHour, newMinute, NewSecond)
Application.Wait WaitTime

Call ClearAttribs
'Call CloseTGSProductsAttribPrep
ActiveSheet.[D2].Activate
Call SaveTextFile 'Previous method used to upload entire database to ecboardco.com site
Call Update_ecboardco
Call UpdatedSavedTextFile

'////////////////////// Timer ///////////////////////////////////////////////
StopTime = Time
Elapsed = StopTime - StartTime
MsgBox "Elapsed Time:" & Chr(13) & Format(Elapsed, "hh:mm:ss")
'////////////////////////////////////////////////////////////////////////////

Application.ScreenUpdating = True
End Sub



Thanks,

Doug

YellowLabPro
10-14-2008, 06:45 AM
This is the original sub, I have remarked out the calls that I want to separate into a new sub.


Sub Upload_ecboardco()
'////////////////////// Timer ///////////////////////////////////////////////
Dim StartTime As Variant, StopTime As Variant, Elapsed As Variant
StartTime = Time
'////////////////////////////////////////////////////////////////////////////

Dim y, z, a, b, w, x
Dim wbSource As Workbook
Dim wsSourceFF As Worksheet, wsSourceVB As Worksheet, wsTarget As Worksheet
Dim rng1 As Range, rng2 As Range
Dim lrTarget As Long, numColumns As Long, i As Long, ii As Long, iii As Long
Dim lngRowCountWSF As Long, lngRowCountWSV As Long, iStatus As Long
Dim wbn As String, wPath As String
Dim newHour As Double, newMinute As Double, NewSecond As Double, WaitTime As Double

Application.ScreenUpdating = False
Call CopyTodayYesterday
wbn = "MasterImportSheetWebStore.xls"
wPath = "C:\Documents and Settings\Doug\Desktop\TGS\"

'Ensure MasterImportWebStore.xls is open, if not, open it, _
'if it is, go to FF "wbSource"."wbn"
err.Clear
On Error Resume Next
Set wbSource = Workbooks(wbn)
iStatus = err
If iStatus Then
Workbooks.Open wPath & wbn
On Error GoTo 0
Else
wbSource.Activate
End If


Set wsSourceFF = Workbooks(wbn).Sheets("PCCombined_FF")
'Set wsSourceVB = Workbooks(wbn).Sheets("PCCombined_VB")
'Set Wsc = Workbooks("Complete_Upload_File.xls").Sheets("EC Products")
Set wsTarget = Workbooks("Complete_Upload_File_Green.xls").Sheets("EC Products")
'LastRow = Wsc.Cells(Rows.Count, 1).End(xlUp).Row
lrTarget = lr(wsTarget, 1)
wsTarget.Range("A4", wsTarget.Cells(lrTarget, "T")).ClearContents
wsTarget.Activate
a = Array("B", "D", "E", "H", "I", "J", "M", "N", "P", "R", "S", "T", "V") ' Change to columns to copy from (separate with ,) Sum must match numColumns
b = Array("A", "B", "M", "E", "F", "C", "H", "G", "N", "O", "P", "Q", "J") ' Change to columns to paste to (separate with ,) Sum must match numColumns
numColumns = UBound(a) + 1
If UBound(a) <> UBound(b) Then
MsgBox "The sum of elements in array a and b must match."
Exit Sub
End If
Application.ScreenUpdating = False
ReDim y(1 To 1, 1 To numColumns)
ReDim z(1 To 1, 1 To numColumns)
lngRowCountWSF = wsSourceFF.Cells(Rows.Count, 1).End(xlUp).Row
lngRowCountWSV = wsSourceVB.Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To numColumns
wsSourceFF.Range(wsSourceFF.Cells(4, a(i - 1)), wsSourceFF.Cells(lngRowCountWSF, a(i - 1))).Copy _
wsTarget.Range(wsTarget.Cells(4, b(i - 1)), wsTarget.Cells(lngRowCountWSF, b(i - 1)))
' wsSourceVB.Range(wsSourceVB.Cells(4, a(i - 1)), wsSourceVB.Cells(lngRowCountWSV, a(i - 1))).Copy _
' wsTarget.Range(wsTarget.Cells(lngRowCountWSF + 1, b(i - 1)), _
' wsTarget.Cells(lngRowCountWSV + lngRowCountWSF - 3, b(i - 1)))
Next

wsTarget.Range(Cells(4, "R"), Cells(wsTarget.Cells(Rows.Count, 2).End(xlUp).Row, 18)) = "NO"
'Wsc.Range(Cells(4, "X"), Cells(Wsc.Cells(Rows.Count, 2).End(xlUp).Row, 24)) = "--None--"
wsTarget.Range(Cells(4, "S"), Cells(wsTarget.Cells(Rows.Count, 2).End(xlUp).Row, 19)) = "Active"
wsTarget.Range(Cells(4, "T"), Cells(wsTarget.Cells(Rows.Count, 2).End(xlUp).Row, 20)) = "EOREOR"
Application.ScreenUpdating = True
Columns("H").NumberFormat = "@"

Call removeDupes
Call Dec2FracII
Call CorrectDateSizing
Call Dates2Sizes

newHour = Hour(Now())
newMinute = Minute(Now())
NewSecond = Second(Now()) + 2
WaitTime = TimeSerial(newHour, newMinute, NewSecond)
Application.Wait WaitTime

' Call AttribPriceSize
'
' newHour = Hour(Now())
' newMinute = Minute(Now())
' NewSecond = Second(Now()) + 2
' WaitTime = TimeSerial(newHour, newMinute, NewSecond)
' Application.Wait WaitTime
'
' Call ImportAttribs
'
' newHour = Hour(Now())
' newMinute = Minute(Now())
' NewSecond = Second(Now()) + 2
' WaitTime = TimeSerial(newHour, newMinute, NewSecond)
' Application.Wait WaitTime
'
' Call JoinAttribs
'
' newHour = Hour(Now())
' newMinute = Minute(Now())
' NewSecond = Second(Now()) + 2
' WaitTime = TimeSerial(newHour, newMinute, NewSecond)
' Application.Wait WaitTime
'
' Call ClearAttribs
' 'Call CloseTGSProductsAttribPrep
' ActiveSheet.[D2].Activate
' Call SaveTextFile 'Previous method used to upload entire database to ecboardco.com site
' Call Update_ecboardco
' Call UpdatedSavedTextFile

'////////////////////// Timer ///////////////////////////////////////////////
StopTime = Time
Elapsed = StopTime - StartTime
MsgBox "Elapsed Time:" & Chr(13) & Format(Elapsed, "hh:mm:ss")
'////////////////////////////////////////////////////////////////////////////

Application.ScreenUpdating = True
End Sub

mikerickson
10-14-2008, 06:46 AM
use the VB editor's find to search the Project for "Sub importAttribs" to find the duplicate declaration.

YellowLabPro
10-14-2008, 07:06 AM
Thanks Mike. I see what I did and how this was not a problem previously.