1. Public Sub Auto_Open()in
End
.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
.CommandBars("Status Bar").Visible = False
With Application
.CommandBars("Formating")
.Visible = False - not
in this version
.DisplayFormulaBar = False
.DisplayScrollBars = False
.Caption = " "
.ActiveWindow.Caption = ""
.ActiveWindow
.DisplayHeadings = False
.ActiveWindow.DisplayWorkbookTabs = False
.ActiveWindow.DisplayVerticalScrollBar = False - also possible
.ActiveWindow.DisplayHorizontalScrollBar = False - also possible
.WindowState = xlNormal
End With
make some sheets
invisible, such as:
Security Warning -
Automatic update of
links has been disabled
For Each theBar In
Application.CommandBars
Call readMailTXT(get_mailArrOfRQSku, get_subjSKUtoBeSetUpQuant)
Call SetupBestBuy
Call Notification_Email(get_arr_of_set_up_SKU, PIMId,
get_arr_of_UPC, ArrMarketDataHeaders, MarketingMatrix)
Call Save_Exit
On Error Resume Next
theBar.Enabled = False
Next
End For Each
2. Public Sub Auto_Close()
End
.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",True)"
.CommandBars("Status Bar").Visible = True
.CommandBars("Formating").Visible = True - not in this version
.DisplayFormulaBar = True
.DisplayScrollBars = True
.ActiveWindow.DisplayHeadings = True
.ActiveWindow.DisplayWorkbookTabs = True
.ActiveWindow.DisplayVerticalScrollBar = True - also possible
.ActiveWindow.DisplayHorizontalScrollBar = True - also possible
.Caption = Empty
.ActiveWindow.Caption = False
.WindowState = xlNormal
With Application
End With
make other sheets visibe
again; such as: Security
Warning - Automatic
update of links
has been disabled
For Each theBar In
Application.CommandBars
On Error Resume Next
theBar.Enabled = True
Next
End For Each
3. Public Sub Save_Exit()
End
Application.DisplayAlerts
= False
PL_OPEN = True ?
Application.Workbooks(C_myMacroFile).Activate
Application.Workbooks(C_myMacroFile).Save
Application.Quit
Application.Workbooks
(filePL).Close
SaveChanges:=False
Yes
No
4. Public Function
GetOpenIEByURL(ByVal
pop_up_URL As String) As
SHDocVw.InternetExplorer
End
VBA MACRO - TOOLS - REFERENCES - BROWSE - go to WINDOWSSYSTEM32shdocvw.dll
(will add MICROSOFT INTERNET CONTROL - TICK THIS OPTION)
Function uses the SHDocVw.ShellWindows object to iterate the running IE instances
ignore errors when accessing the document property
On Error Resume Next
Loop over all
Shell-Windows
For Each GetOpenIEByURL
In objShellWindows
If the document is of
type HTMLDocument,
it is an IE window
TypeName(GetOpenIEByURL
.Document) =
"HTMLDocument" ?
Debug.Print
TypeName(GetOpenIEByURL
.Document)
check the URL
GetOpenIEByURL.Document
.URL = pop_up_URL ?
leave, we found
the right window
Next
End For Each
Yes
No
Yes
No
5. Private Function
GetXLCol(ByVal Col As
Integer) As String
End
ASCII value For capital A
Col is the present column, not the number of cols
THIS ALGORITHM ONLY WORKS UP TO ZZ. It fails on AAA
Col > 701 ?
Col <= 25 ?
GetXLCol = ""
GetXLCol = sCol
sCol = Chr(A + Col)
iRemain = Int((Col / 26)) - 1
sCol = Chr(A + iRemain) & GetXLCol(Col Mod 26)
Yes
No
Yes
No
6. Sub readMailTXT
(mailArrOfRQSku,
subjSKUtoBeSetUpQuant)
End
, subjSKUtoBeSetUpQuant
As Byte
Open plocha2 & "" &
soubor_na_plose For
Input Access Read As #1
Not EOF(1) ?
subjLength = LOF(1)
Close #1
subjSKUtoBeSetUpQuant = 0
Input #1, mailSubject
----00000 until
the 4th position,
For subjCharNo = 4 To
(subjLength - 5)
the dash is not relevant
is_num = False
not_num = False
std_chr = False
not_std = False
Mid(mailSubject,
subjCharNo, 1) = "-" ?
ASCII code for numerical
characters must follow
For krok = 1 To 5 Step 1
SKU char to the left
must be alphanumeric,
lower case will
be capitalized
t = Asc(Mid(mailSubject,
subjCharNo + krok, 1))
(48 <= t And t <= 57) ?
is_num = True
not_num = True
Next krok
For krok = 1 To 3 Step 1
not_num = False And
Not_std = False ?
t = Asc(UCase(Mid
(mailSubject, subjCharNo
- 4 + krok, 1)))
(48 <= t And t <= 57) Or
(65 <= t And t <= 90) ?
std_chr = True not_std = True
Next krok
ReDim Preserve
mailArrOfRQSku
(subjSKUtoBeSetUpQuant)
SKU is nine digits long
mailArrOfRQSku(subjSKUtoBeSetUpQuant) = UCase(Mid(mailSubject, (subjCharNo - 3), 9))
subjSKUtoBeSetUpQuant = subjSKUtoBeSetUpQuant + 1
Debug.Print Mid(mailSubject, (subjCharNo - 3), 9)
Debug.Print mailArrOfRQSku(subjSKUtoBeSetUpQuant - 1)
Next subjCharNo
Yes
No
End For
Yes
No
End For
Yes
No
End For
Yes
No
Yes No
7. Sub Notification_Email
(ByVal get_arr_of_set_up_
SKU, ByVal PIMId, ByVal
get_arr_of_UPC, ByVal
ArrMarketDataHeaders,
ByVal MarketingMatrix)
End
works in Office 2000-2007
p = 0
Application.DisplayAlerts = False
this error subscript out
of range in the field
get_arr_of_set_up_SKU
will occur when we are
not logged in to
corporate network, thus
opening of Price List
will return this error
On Error GoTo Chyby2
and then we run this
procedure with arrays
that have no dimensions,
thus this procedure
would return another
error -> finish
makro -> RAS
Set OL_App = CreateObject("Outlook.Application")
OL_App.Session.Logon
Set OL_Mail = OL_App.CreateItem(0)
message = False
SetUpQuant <> 0 And
done_1 = True ?
signature = "Regards," & vbNewLine & vbNewLine & "Ales
Vymyslicky (Accenture)" & vbNewLine & "E&D NAOC Transaction
Team" & vbNewLine & "tel: + 420 225 042 496" &
vbNewLine & "e-mail: v-alvymy@microsoft.com"
On Error Resume Next
mailBody_part1 = "Hello
everyone," & vbNewLine &
vbNewLine & "Please be
inFormed that the "
UBound(get_arr_
of_set_up_SKU) < 1 ?
mailSubject = ""
mailBody_part3 = ""
mailBody_part2 = "item
below has been set up on
the PIM portal:" &
vbNewLine & vbNewLine
mailBody_part2 = "items
below have been set up
on the PIM portal:" &
vbNewLine & vbNewLine
For m = 0 To
UBound(get_arr_of_
set_up_SKU)
message = True
mailSubject = mailSubject & get_arr_of_set_up_SKU(m) & " ; "
mailBody_partX = "This is the PIM Id# " & PIMId(m) & vbNewLine & "This is the UPC# " &
get_arr_of_UPC(m) & vbNewLine & "This is the SKU# "
& get_arr_of_set_up_SKU(m) & vbNewLine & vbNewLine
mailBody_part3 = mailBody_part3 & mailBody_partX
For n = 0 To
UBound(ArrMarketDataHeaders)
ArrMarketDataHeaders(n)
= "1st Image" Or
ArrMarketDataHeaders(n)
= "2nd Image" ?
ReDim Preserve photographs(p)
photographs(p) = MarketingMatrix(m, n)
p = p + 1
Next n
Next m
done_2 = True ?
nic z toho nemohlo
byt naset-upovano
mailBody_part1 = zprava
& vbNewLine & vbNewLine
(neni na PL), mohou nastat pripady: vse bylo
udelano, nic nebylo udelano, neco z toho
bylo udelano, neco bylo udelano a zbytek neni
na PL, do budoucna pripad bylo udelano drive
message = True
message = True ?
On Error GoTo 0
Set OL_Mail = Nothing
Set OL_App = Nothing
"skuaoc@winse
.microsoft.com"
With OL_Mail
.SentOnBehalfOfName = "v-alvymy@microsoft.com"
.To = "v-annahe@microsoft.com; v-ivoten@microsoft.com"
.CC = "skuaoc@winse.microsoft.com"
.BCC = ""
.Subject = "SKU set-up notification for the " & mailSubject
.Body = mailBody_part1 & mailBody_part2 & mailBody_part3 & signature
For p = 0 To
UBound(photographs)
or use .Send
straight away
.Attachments.Add
(photographs(p))
Next p
.Display
End With
Chyby2: Application
.DisplayAlerts = False
Application.Quit
Yes
No
Yes
No
End For
End For
Yes
No
Yes
No
Yes
No
End For
9. Sub pvtus_SQL_dotaz(tier,
layer, ByVal current_SKU)
End
Set objRecordset = CreateObject("ADODB.Recordset")
PartN = "'" & current_SKU & "'"
objConnection.Open "Provider=SQLOLEDB;Integrated Security=SSPI;Persist Security Info=True;Initial
Catalog=AdHocReporting;Data Source=Homedepot;Use Procedure For Prepare=1;Auto Translate=True;Packet
Size=4096;Workstation ID=OM761600;Use Encryption For
Data=False;Tag With column collation when possible=False"
strSQL = "SELECT EndItemPallet.EndItemPalletID, EndItemPallet.EndItemOperationsViewID,
EndItemPallet.PalletSizeCodeID, EndItemPallet.PalletQuantity, EndItemPallet.PalletTie,
EndItemPallet.PalletLayers, EndItemOperationsView.EndItemOperationsViewID,
EndItemOperationsView.MaterialID,
Material.MaterialID, Material.PartNumber FROM
AdHocReporting.dbo.EndItemOperationsView EndItemOperationsView,
AdHocReporting.dbo.EndItemPallet EndItemPallet,
AdHocReporting.dbo.Material Material WHERE (Material.MaterialID
= EndItemOperationsView.MaterialID) AND (EndItemPallet.EndItemOperationsViewID =
EndItemOperationsView.EndItemOperationsViewID) AND (EndItemPallet.PalletSizeCodeID=1204) AND
(Material.PartNumber=" & PartN & ")"
objRecordset.Open strSQL, objConnection
tier = objRecordset.Fields.Item("PalletTie").Value
layer = objRecordset.Fields.Item("PalletLayers").Value
pom = objRecordset.Fields
.Item("PartNumber").Value
10. Sub SetupBestBuy()
End
SetUpQuant udava SKUtoBeSetUpQuant - notSetUpQuant(realna-co je na PL)
SetUpQuant udava pri Dimenzovani MatrixPLfltrd index radku vcetne zahlavi
bude nacitat ruzne cis Formaty, aby se pak dodrzely
pro ucely Formula row, kde pridava Excel
ve slove Fry's jeste jeden quote na vic
input field
input field
login button PLtab = "Price
List Report"
Application.OnTime Now + TimeValue("00:30:00"), "Save_Exit" 'autotermination
If error and no response in 30 mins Then autotermination, however problem With
multiple set-ups - how long period? For 6 SKUs, maybe 3 hours. For 1 Sku, 30 min
Saving to Best Buy database via portal is extremely slow -> 1 set-up takes 25 min
reseni: cas, za ktery nastane autoterminace by se mohl menit = SetUpQuant * 30 min
MyDate contains the current system date.
MyDate = Date
MyDay = Day(MyDate)
MyMonth = Month(MyDate)
MyYear = Year(MyDate)
YY = MyYear Mod 100
YY = "0" & YY
MyMonth < 10 ?
MyDay >= 15 ?
MM = "0" & MyMonth MM = MyMonth
***** Tracking down the latest pathPL and
actual filePL name *** (or the 2nd latest)**
***** IT Connection Manager must be connected
via RAS Card !!! *******************
DD = "15" DD = "01"
On Error GoTo Chyby
pathPL = pathPL_C1 & MM & DD & YY & pathPL_C2
typeselection = "*.xls"
the first listed filePL
will be loaded into the
filePL string variable
otherwise an Empty string
filePL = Dir(pathPL &
typeselection,
vbReadOnly)
searching For the
substring, returns
0 If not found
filePLSubstringIND =
InStr(1, filePL,
C_SubString)
alternatively, to be
more specific: If
filePLSubstringIND
= 14 Then
filePLSubstringIND <> 0 ?
Workbooks.Open
Filename:=pathPL & "" &
filePL, ReadOnly:=True
PL_OPEN = True
On Error GoTo PLnotReady
account name starts
always on the 14th
character so
it could be: Do
filePLSubstringIND = 0 ?
filePLSubstringIND
<> 14 ?
read the Next filePL in
the directory If there
is none Then an Empty
string will be assigned
filePL = Dir()
filePLSubstringIND = InStr(1, filePL, C_SubString)
filePLSubstringIND <> 0 ?
PLnotReady: ***** Tracking down the 2nd latest PL pathPL and its
name If filePLSubstringIND = 0 ***************
***** from now on it will continue With opening
the PL belonging to the previous period
Workbooks.Open Filename:=pathPL & "" & filePL, ReadOnly:=True
PL_OPEN = True
filePLSubstringIND = 0 ?
If PL is not Ready
***** How many arrays are there on the PL? + Loading the headers
into an array + Searching For the PartNumber
Response = MsgBox("The
pathPL " & pathPL & "
does not exist, has been
changed, or the latest
PL has not been issued
yet. Would you like to
try to open the older
one?", vbYesNo
+ vbCritical)
If NO - GOTO chyby, PL
neni dostupny, see
Else na radku 106
Response = vbYes ?
***** start reading the
PL from the preceding
period *****
MyDay >= 15 ?
DD = "01"
pathPL = pathPL_C1 & MM & DD & YY & pathPL_C2
typeselection = "*.xls"
the first listed filePL
will be loaded into the
filePL string variable
otherwise an Empty string
filePL = Dir(pathPL & typeselection, vbReadOnly)
filePLSubstringIND = InStr(1, filePL, C_SubString)
filePLSubstringIND <> 0 ?
Workbooks.Open Filename:=pathPL & "" & filePL, ReadOnly:=True
PL_OPEN = True
On Error GoTo Chyby
filePLSubstringIND = 0 ?
filePL = Dir()
filePLSubstringIND = InStr(1, filePL, C_SubString)
filePLSubstringIND <> 0 ?
Workbooks.Open Filename:=pathPL & "" & filePL, ReadOnly:=True
PL_OPEN = True
DD = "15"
MyMonth <= 10 ?
pathPL = pathPL_C1 & MM & DD & YY & pathPL_C2
typeselection = "*.xls"
MyMonth = 1 ?
MM = "12"
YY = (MyYear Mod 100) - 1
YY = "0" & YY
MyMonth = MyMonth - 1
MM = "0" & MyMonth
MyMonth = MyMonth - 1
MM = MyMonth
the first listed filePL
will be loaded into the
filePL string variable
otherwise an Empty string
filePL = Dir(pathPL & typeselection, vbReadOnly)
filePLSubstringIND = InStr(1, filePL, C_SubString)
filePLSubstringIND <> 0 ?
Workbooks.Open Filename:=pathPL & "" & filePL, ReadOnly:=True
PL_OPEN = True
On Error GoTo Chyby
account name starts
always on the
14th character
filePLSubstringIND = 0 ?
read the Next filePL in
the directory If there
is none Then an Empty
string will be assigned
filePL = Dir()
filePLSubstringIND = InStr(1, filePL, C_SubString)
filePLSubstringIND <> 0 ?
Workbooks.Open Filename:=pathPL & "" & filePL, ReadOnly:=True
PL_OPEN = True
***** Else
response is vbNo
Header *******
Application.ScreenUpdating = False
!!! nutno aktivovat
spravny tab !!!
Workbooks(filePL).Sheets(PLtab).Activate
Range("A1").Select
Header = ActiveCell.FormulaR1C1
ColQuant = 0
Header <> Empty ?
MID is a text Function and it returns a specific number of characters from a text
string, starting at the position you specify, based on the number of characters you specify
ActiveCell.Address returns the address in $F$1 Format, so we need the position 2
***** Refreshing the "Is the SKU on the PL? " CELLS - Column B ******************
***** according to the latest MM DD YY Tiger's PL *********************************
ColQuant = ColQuant + 1
ColNo = ActiveCell.Column
ReDim Preserve ArrHeaders(ColQuant - 1)
ArrHeaders(ColQuant - 1) = Header
ReDim Preserve ArrVirtualColumnLetters(ColQuant - 1)
ColNo < 27 ?
ArrVirtualColumnLetters
(ColQuant -
1) = ColLetter
ColLetter =
Mid(ActiveCell.Address,
2, 1)
Header = C_MSSKU ?
SKUColLetter = Mid(ActiveCell.Address, 2, 1)
ColNoSku = ColNo
teoreticky pro $AA$1
ColLetter =
Mid(ActiveCell.Address,
2, 2)
Header = C_MSSKU ?
SKUColLetter = Mid(ActiveCell.Address, 2, 1)
ColNoSku = ColNo
virtual - slupec nemusi
existovat, pocet
se muze menit
ActiveCell.Offset(0, 1).Select
Header = ActiveCell.FormulaR1C1
Windows(C_myMacroFile).Activate
Sheets(C_myMacroSheet).Range("A2:B12").Select
Selection.ClearContents
Qfile = MM & DD & YY & FDQuote
Const FDQuote =
"_MS_PC_Fry''s.xls" 'pro
ucely Formula row -
specifically for FRYS
containing quote
PLtab = "Price
List Report"
assigning quote
uv = "'"
Range("A1").Select
For increment = 0 To
get_subjSKUtoBeSetUpQuant
- 1
Range("A2").Select
increment = 2
writing input SKUs from
emailSKUinputSKUsBEPC
.txt to worksheetu
ActiveCell.Offset
(increment + 1, 0).Value
= get_mailArrOfRQSku
(increment)
Next increment
konvertuje byte na
string automatickym
prirazenim
incstring = increment
RQSkuCELL = "A" & incstring
SKUtoBeSetUp = ActiveCell.FormulaR1C1
osetreni chyb lze vynechat, v pripade chyby
vraci vlookup do bunky #N/A , t.j. nenalezl
On Error Resume Next
Err.Clear
SKUtoBeSetUpQuant = 0
SKUtoBeSetUp <> Empty ?
***** End of refreshing *********************************************************
***** Records refreshing in line With the inputted SKUs *************************
***** Printing headers **********************************************************
?there is one extra
value in the array, we
wont need it, it is an
address of the
last empty cell
ReDim Preserve ArrOfRQSkuCELL(SKUtoBeSetUpQuant)
ArrOfRQSkuCELL(SKUtoBeSetUpQuant) = RQSkuCELL
ReDim Preserve ArrOfRQSku(SKUtoBeSetUpQuant)
ArrOfRQSku(SKUtoBeSetUpQuant) = SKUtoBeSetUp
increment = increment + 1
cellTEXT = "=If(iserror(vlookup(" & RQSkuCELL & "," & uv & "[" & Qfile & "]" & PLtab & uv & "!$" &
SKUColLetter & ":$" & SKUColLetter & ", 1, False)), 0, 1)"
ActiveCell.Offset(0, 1).Value = cellTEXT
ReDim Preserve ArrOfPLind(SKUtoBeSetUpQuant)
ActiveCell.Offset(0,
1).Value = 1 ?
SKUtoBeSetUpQuant = SKUtoBeSetUpQuant + 1
incstring = increment
RQSkuCELL = "A" & incstring
ArrOfPLind
(SKUtoBeSetUpQuant)
= True
ArrOfPLind
(SKUtoBeSetUpQuant)
= False
If Err.Number = 0 Then
MsgBox "The SKU has been found on the current Fry's PL"
Else
MsgBox "The SKU is not on the current Fry's PL"
(jinak pro vsechny ostatni chyby by mohl zobrazit tento MsgBox)
End If
ActiveCell.Offset(1, 0).Select
SKUtoBeSetUp = ActiveCell.FormulaR1C1
For i = 1 To
ColQuant Step
1
***** Clearing cells
*************************
*******************
****************
Range("A15").Select
ActiveCell.Offset(0, i - 1).Value = ArrHeaders(i - 1)
Next i
Sheets(C_myMacroSheet).Range("A16:AC26").Select
Selection.ClearContents
***** Loading
SKUtoBeSetup one by one:
Do While SKUtoBeSetUp <>
Empty ***********
Range("A2").Select
SKUtoBeSetUp = ActiveCell.FormulaR1C1
zajistime filtrovani az
od druheho radku
SKU sloupce
SkuColRange1 =
SKUColLetter & "2"
w = 0
y = 0
notSetUpQuant = 0
nacita z input array dokud nenarazi na Empty cell
rowVirtual = 1
SKUtoBeSetUp <> Empty ?
Chyby:
nelzeulozit:
»3 »4
** 1 **
** 2 **
Yes No
Yes No
Yes
No
Yes No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
End For
Yes
No
Yes
No
End For
Yes No
11. ***** loading cells that
might be used into a
matrix a zkouska
tisku **************
SetUpQuant = SKUtoBeSetUpQuant - notSetUpQuant
SetUpRowFltrd = 0
Windows(C_myMacroFile).Activate
Sheets(C_myMacroSheet).Select
Range("a15").Select
napr 0 az SetUpQuant, 0
az 28 = 29 sloupcu
ReDim MatrixPLfltrd
(SetUpQuant,
ColQuant - 1)
For i = 0 To
w
from now on we shall
only print the matrix
just to test
values and Formates
ActiveCell <> Empty ?
Do While ActiveCell = Empty 'preskoci prazdne bunky
ActiveCell.Offset(1, 0).Select
Loop
For j = 0 To ColQuant - 1
SetUpRowFltrd = SetUpRowFltrd + 1
ActiveCell.Offset(1, -ColQuant).Select
!!!
value!!!
MatrixPLfltrd
(SetUpRowFltrd, j)
= ActiveCell.Value
vezme vyslednou hodnotu vzorce a ne
vzorec v dane bunce a ulozi hodnotu do
MatrixPLfltrd, to je rozdil od ActiveCell.Formula[R1C1]
ActiveCell.Offset(0,
1).Select
Next j
ActiveCell.Offset(1,
0).Select
Next i
Range("a29").Select
tisk bez zahlavi
-> od 1 ne od 0
For i = 1 To SetUpQuant
Workbooks(filePL).Close False - pokud zavru
PL tak indirect bude ukazovat ihned REF
OPEN MARKETING & TECHNICAL DATA SHEET
*********************************************
For j = 0 To ColQuant - 1
ActiveCell.Offset(1,
-ColQuant).Select
Select Case
MatrixPLfltrd(0, j)
ActiveCell.Value = MatrixPLfltrd(i, j)
ActiveCell.Offset(0, 1).Select
C_MSD ?
C_DateDiscontinued ?
Selection.NumberFormat
= "mm/dd/yy"
C_StartEffectiveDate ?
Selection.NumberFormat
= "mm/dd/yy"
C_EndEffectiveDate ?
Selection.NumberFormat
= "mm/dd/yy"
C_UPC ?
Selection.NumberFormat
= "mm/dd/yy"
C_MPQ ?
Selection.NumberFormat
= "0"
C_PalletQuantity ?
Selection.NumberFormat
= "0"
C_NetPrice ?
Selection.NumberFormat
= "0"
C_MSRP ?
Selection.NumberFormat
= "0.00"
C_Un_Weight ?
Selection.NumberFormat
= "0.00"
C_Un_Length ?
Selection.NumberFormat
= "0.00"
C_Un_Width ?
Selection.NumberFormat
= "0.00"
C_Un_Depth ?
Selection.NumberFormat
= "0.00"
C_MP_Weight ?
Selection.NumberFormat
= "0.00"
C_MP_Length ?
Selection.NumberFormat
= "0.00"
C_MP_Width ?
Selection.NumberFormat
= "0.00"
C_MP_Depth ?
Selection.NumberFormat
= "0.00"
Else
Selection.NumberFormat
= "0.00"
Selection.NumberFormat
= "GENERAL"
Next j
Next i
On Error GoTo Chyby
vyhledame z marketingove
databaze jen ta SKU,
ktera jsou na PL
Workbooks.Open
Filename:=plocha & "" &
C_myMarketData,
ReadOnly:=True
!!! nutno aktivovat
spravny tab !!!
Workbooks(C_myMarketData).Sheets("Sheet1").Activate
Range("A1").Select
MarketDataHeader = ActiveCell.FormulaR1C1
MarketDataColQuant = 0
MarketDataHeader
<> Empty ?
ReDim MarketingMatrix
(SetUpQuant - 1,
MarketDataColQuant - 1)
MarketDataColQuant = MarketDataColQuant + 1
ReDim Preserve ArrMarketDataHeaders(MarketDataColQuant - 1)
ArrMarketDataHeaders(MarketDataColQuant - 1) = MarketDataHeader
ActiveCell.Offset(0, 1).Select
MarketDataHeader = ActiveCell.FormulaR1C1
For i = 1 To SetUpQuant
Application.DisplayAlerts = False
Application.Workbooks(C_myMarketData).Close SaveChanges:=False
current_SKU = MatrixPLfltrd(i, ColNoSku - 1)
k = 0
ArrMarketDataHeaders(k)
<> C_PartNumber ?
ArrMarketDataHeaders(k)
= C_PartNumber ?
k = k + 1
Range(SKUColLetter
& "1").Activate
SKUColLetter =
GetXLCol(ByVal k)
ted vyhledame to current_SKU jestli v te databazi je (melo by byt, kdyz je na PL),
a jestli vsechny atributy jsou vyplnene to nebudeme zjistovat - databazi je nutno
aktualizovat kazdych 14 dni - Pokud databaze nebude aktualni (SKU nenalezeno), pak
cyklus pobezi do posledniho radku Excelu a nastane chyba -> makro se ukonci, coz je
dobre, aby nesetupoval pak v kategoriich nesmysly !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Muzem vypsat hlaseni, ze databaze atributu neni aktualni. !!!!!!!!!!!!!!!!!!dodelat
done = False
current_SKU <>
ActiveCell.FormulaR1C1
And done = False ?
ActiveCell.Offset(1,
0).Select
current_SKU =
ActiveCell.FormulaR1C1 ?
R = ActiveCell.Row
Range("A" & R).Activate
For jj = 0 To
MarketDataColQuant - 1
done = True
MarketingMatrix(i - 1,
jj) = ActiveCell
.Offset(0, jj).Value
Next jj
Next i
kontrolni bajt, ze minimalne 1 SKU bylo nasetupovano
*********************** CYKLUS - SKU SETUP **************************************
*** pro vsechna SKU -> i = 1 To SetUpQuant **************************************
done_1 = False
kontrolni bajt rika, ze
alespon 1 SKU
bylo submitovano
done_2 = False
kontrolni bajt rika, ze
jsme se presvedcili o
pravdivosti If
SetUpQuant <> 0 Then
done_3 = False
a ze nenastala chyba On
Error GoTo nelzeulozit
Set IE = Nothing
On Error GoTo nelzeulozit
SetUpQuant <> 0 ?
Application
.ScreenUpdating = True
nebereme v uvahu prvni
radek MatrixPLfltrd -
zahlavi; vyuzijeme
pro prehlednost
For i = 1 To SetUpQuant
or Call is_busy(IE)
ArrHeaders
If ArrOfPLind(i
- 1) = True Then
IE Is Nothing ?
IE.Busy And Not
IE.ReadyState = 4 ?
Set IE =
CreateObject
("InternetExplorer
.Application")
.Left = 50
.Top = 50
.Height = 800
.Width = 1000
.MenuBar = 0
.Toolbar = 1
.StatusBar = 0
.navigate C_PIMPORTAL_LOGIN
With IE
wait a while until IE
has finished to load
Call is_busy(IE)
OR eq:
Do While IE.busy And Not IE.readystate = 4 : DoEvents : Loop
.Visible = 1
End With
login - enter ID,
pass and click OK
.getElementById(C_element_userID).Value = C_myID
.getElementById(C_element_password).Value = C_myPW
.getElementById(C_element_PC_7_0_64__login).Click
With IE.Document
End With
Call is_busy(IE)
click on Item induction
RUN the JAVASCRIPT Function from Within VBA
(Function PC_7_0_IS_openURL in the HTML)
DoEvents
IE.Document.all.Item
Call IE.Document.parentWindow.execScript
("javascript:PC_7_0_IS_openURL('Item Induction')",
"JavaScript")
Call is_busy(IE)
Excell VBA Calls the Javascript Function openItemNew
Complete Non Data Pool Item - should be New -
an mistake in HTML - does not effect anything
IE.Document.all.Item
Call IE.Document.parentWindow.execScript("javascript:openItemNew('Complete
Non Data Pool Item')",
"JavaScript")
Call is_busy(IE)
Wait and fill in the Form
******** SELECT CATEGORY AND GENERAL
TAB *******************************
IE.Document.all.Item("PC_7_0_J3_Category").Click
Call is_busy(IE)
pop_up_URL =
"https://pimportal.bestbuy.com/wps/myportal/!ut/p/kcxml
/04_Sj9SPykssy0xPLMnMz0vM0Y_QjzKLN4h3DgDJgFjGpvqRqCKOcAFf
j_zcVP0gfW_9AP2C3NCIckdHRQDCtOS9/delta/base64xml
/L0lJWWtpQ1NZL0lGakFBQVRBQUNKQUFNekNxcUEhLzRJVUdSWVFxTkhwQ0d3ZyE
vNl8wX0NULzdfMF9MVS82XzBfQ1A!?CATALOG_NAME=Trade Item
Catalog&ATTR_NAME=&KEY_CATEGORY_SELECTION=YES&KEY_ITEM_ID=null&KEY_GPC_CATEGORY=&KEY_COLLAB_ID=Item
Induction&WF_ITEM=True"
funkce v deklaracni
casti vraci
Set pop_up =
GetOpenIEByURL
(pop_up_URL)
objekt ze sbirky oken shellu
* V matici musim zjistit cisla sloupcu tech poli podle kterych budu zarazovat do kategorii
v kazdem pripade je mandatorni ColNoItemName a ColNoBusUnit,
v pripade ColNoDivName, ColNoProType, ColNoLegalName je potreba tyto
promenne take inicializovat, protoze nebudou soucasti pole Headeru
ArrHeaders na Xbox ceniku, jinak by byla chyba pri testovani.
I kdyz nebudeme napr. ColNoDivName potrebovat pri otevrenem Xbox ceniku,
musime nastavit tuto promennou napr. na 1 a bude pak odkazovat na
PriceListName = "UNITED STATES BEST BUY USD FPP" sloupec, takze vysledek
jakehokoliv testovani na nejaky substring bude stejne 0.
ColNoDivName = 1
ColNoProType = 1
ColNoLegalName = 1
For j = 0 To
(ColQuant -
1)
* determinace kategorie na bazi
ItemName, BusUnit, DivName, ProType
Predpoklad, ze kategorie je PC_SW_non_VG
Select Case ArrHeaders(j)
C_ItemName ?
C_LegalName ?
ColNoItemName = j + 1
C_BusUnit ?
ColNoLegalName = j + 1
C_DivName ?
ColNoBusUnit = j + 1
C_ProType ?
ColNoDivName = j + 1
ColNoProType = j + 1
Next j
kategorie =
"PC_SW_non-VG"
InStr(1,
UCase(MatrixPLfltrd(i,
ColNoItemName -
1)), "ZUNE") <> 0 ?
InStr(1,
UCase(MatrixPLfltrd(i,
ColNoItemName -
1)), "XBOX") <> 0 ?
kategorie = "Zune"
InStr(1,
UCase(MatrixPLfltrd(i,
ColNoBusUnit - 1)),
"ACCESSORIES") <> 0 ?
sluzi jen k
upresneni buyera
kategorie =
"Zune_Accessories"
InStr(1,
UCase(MatrixPLfltrd(i,
ColNoBusUnit - 1)),
"WINDOWS GAMING") <> 0 ?
kategorie = "Accessories"
InStr(1,
UCase(MatrixPLfltrd(i,
ColNoBusUnit - 1)),
"CONSOLE") <> 0 ?
InStr(1,
UCase(MatrixPLfltrd(i,
ColNoBusUnit - 1)),
"PARTY") <> 0 ?
kategorie =
"XBOX_Console"
InStr(1,
UCase(MatrixPLfltrd(i,
ColNoBusUnit - 1)),
"XNA 360") <> 0 ?
kategorie = "XBOX_SW"
InStr(1,
UCase(MatrixPLfltrd(i,
ColNoBusUnit -
1)), "LIVE") <> 0 ?
kategorie = "XBOX_SW"
If InStr(1, UCase(MatrixPLfltrd(i, ColNoItemName - 1)), "CNTRL") <> 0 Or InStr(1,
UCase(MatrixPLfltrd(i, ColNoItemName - 1)), "CONTROLLER")
<> 0 Or InStr(1, UCase(MatrixPLfltrd(i, ColNoItemName
- 1)), "CONTROLLR") <> 0 Or InStr(1, UCase(MatrixPLfltrd(i,
ColNoItemName - 1)), "CNTRLR") <> 0 Or InStr(1,
UCase(MatrixPLfltrd(i, ColNoItemName - 1)), "WHEEL") <>
0 Or InStr(1, UCase(MatrixPLfltrd(i, ColNoBusUnit - 1)),
"GAMING DEVICES") <> 0 Then
kategorie = "Input_Devices-Game_Controller"
kategorie = "Accessories"
InStr(1,
UCase(MatrixPLfltrd(i,
ColNoDivName - 1)), "SDA
HARDWARE") <> 0 ?
kategorie = "VG_PC_SW"
Select Case kategorie
kategorie = "PC_Hardware"
InStr(1,
UCase(MatrixPLfltrd(i,
ColNoBusUnit - 1)),
"MOUSE") <> 0 ?
InStr(1,
UCase(MatrixPLfltrd(i,
ColNoBusUnit - 1)),
"KEYBOARD") <> 0 ?
kategorie =
"Input_Devices-Mice"
InStr(1,
UCase(MatrixPLfltrd(i,
ColNoBusUnit -
1)), "ICE") <> 0 ?
kategorie =
"Input_Devices-Keyboards"
InStr(1,
UCase(MatrixPLfltrd(i,
ColNoLegalName -
1)), "MOUSE") <> 0 ?
kategorie = "Web Cams"
InStr(1,
UCase(MatrixPLfltrd(i,
ColNoLegalName - 1)),
"KEYBOARD") <> 0 ?
kategorie =
"Input_Devices-Mice"
InStr(1,
UCase(MatrixPLfltrd(i,
ColNoLegalName - 1)),
"NOTEBOOK") <> 0 ?
kategorie slouzi jen k
upresneni buyera
kategorie =
"Input_Devices
-Notebook_Mice"
kategorie =
"Input_Devices-Keyboards"
j = 0
"Input_Devices-Game_
Controller" ?
"Input_Devices-Keyboards"
?
super_html_kategorie = " Computer and
Video Game Control and Input Devices"
html_kategorie = " Game Controllers"
"Input_Devices-Mice" ?
super_html_kategorie = " Computer and
Video Game Control and Input Devices"
html_kategorie = " Keyboards"
"Input_Devices
-Notebook_Mice" ?
super_html_kategorie = " Computer and
Video Game Control and Input Devices"
html_kategorie = " Mice and Trackballs"
"Accessories" ?
super_html_kategorie = " Computer and
Video Game Control and Input Devices"
html_kategorie = " Mice and Trackballs"
"Web Cams" ?
super_html_kategorie = " Computer and Video Game Peripherals"
html_kategorie = " Video Game Accessory"
"PC_SW_non-VG" ?
super_html_kategorie = " Computer and Video Game Peripherals"
html_kategorie = " Web Cameras"
"VG_PC_SW" ?
super_html_kategorie = " Computer and Video Game Software"
html_kategorie = " Software Non-Games"
"XBOX_SW" ?
super_html_kategorie = " Computer and Video Game Software"
html_kategorie = " Video Game Computer Software"
"XBOX_Console" ?
super_html_kategorie = " Computer and Video Game Software"
html_kategorie = " Video Game Software"
"Zune" ?
super_html_kategorie = " Video Game Consoles"
html_kategorie = " Video Game Hardware - Non Portable"
"Zune_Accessories" ?
super_html_kategorie = " Video Game Consoles"
html_kategorie = " Video Game Hardware - Portable"
super_html_kategorie = " Video Game Consoles"
html_kategorie = " Video Game Hardware - Portable"
Call is_busy(pop_up)
pop_up.Document.getElementsByTagName("Form")(0).getElementsByTagName("a")(2).Click
Call is_busy(pop_up)
pop_up.Document.getElementsByTagName("Form")(0).getElementsByTagName("a")(4).Click
Call is_busy(pop_up)
pop_up.Document.getElementsByTagName("Form")(0).getElementsByTagName("a")(2).Click
Call is_busy(pop_up)
pop_up.Document.all.tags
("a")(j).innerTEXT <>
super_html_kategorie ?
pop_up.Document.getElementsByTagName("Form")(0).getElementsByTagName("a")(j
- 1).Click
Call is_busy(pop_up)
jj = 0
j = j + 1
pop_up.Document.all.tags
("a")(jj).innerTEXT <>
html_kategorie ?
pop_up.Document.getElementsByTagName("Form")(0).getElementsByTagName("a")(jj).Click
Call is_busy(pop_up)
pop_up.Document.getElementsByTagName("Form")(0).getElementsByTagName("a")(j - 1).Click
jj = jj + 1
*** EXIT POP-UP
With saving: ****
Call is_busy(pop_up)
pop_up.Document.all.Item
("600000017///800000079")
.Click 'item name
differs depending on how
the category
tree is expanded
pop_up.Document.getElementsByTagName("Form")
(0).getElementsByTagName("input")(9).Click
Call is_busy(IE)
Set pop_up = Nothing
For j = 0 To ColQuant - 1
With IE.Document
IE.Busy And Not
IE.ReadyState = 4 ?
Application.Wait (Now + TimeValue("0:00:3"))
IE.Document.all.Item
Call IE.Document.parentWindow.execScript("javascript:PC_7_0_IS_openURL('Item
Induction')", "JavaScript")
Call is_busy(IE)
IE.Document.all.Item("PC_7_0_J1_WORKFLOW_SELECT").Click
Call is_busy(IE)
IE.navigate
"https://pimportal.bestbuy.com/wps/myportal/!ut/p/kcxml
/04_Sj9SPykssy0xPLMnMz0vM0Y_QjzKLN4h39gLJgFjGpvqRqCKOcAFf
j_zcVP0gfW_9AP2C3NCIckdHRQAl6aCR/delta/base64xml
/L0lDU0lKQ1RPN29na21DU1Evb0tvUUFBSVFnakZJQUFRaENFSVFqR0VKemdBIS8
DoEvents
0 SkZpQ28wZWgxaWNvblFWR2h
kLXNJZDJFQSEhLzdfMF9KMS8y
NzIvc2EuU1RFUE5BTUU!?PC_
7_0_J1_STEPNAME=Complete
%20Non%20Data%2
0 Pool%20Item&PC_7_0_J1_COLLABAREA_ID=Item%20Induction&PC_
7_0_J1_WORKFLOW_ID=Item%20Induction%20Workflow%20v1#7_0
_J1"
Call is_busy(IE)
Application.Wait (Now + TimeValue("0:00:3"))
For i = 0 To
SetUpQuant -
1
Call is_busy(IE) equival
j = 0
IE.Document.all.tags
("td")(j).innerTEXT
<> PIMId(i) ?
IE.Busy And Not
IE.ReadyState = 4 ?
j = j + 1
IE.Document.all.tags
("td")(j).innerTEXT
= PIMId(i) ?
IE.Document
.getElementsByTagName
("td")(j -
1).getElementsByTagName
("input")(0).Checked
= True
DoEvents Next i
IE.Busy And Not
IE.ReadyState = 4 ?
done_2 = True
DoEvents LOG OUT
IE.navigate
"https://pimportal.bestbuy.com/wps/myportal/!ut/p/kcxml
/04_Sj9SPykssy0xPLMnMz0vM0Y_QjzKLN4h39gLJgFjGpvqRqCKOcAFf
j_zcVP0goESkOVDEy1A_Kic1PTG5Uj9Y31s_QL8gNzSi3NvREQD-ps-
S/delta/base64xml/L0lKSklKSWchL0lCakFBR3lBQkVRaUlBISEvNElENnhCX1dFTkRDLzEwOTUvMTM3NzIvbG8!"
zavrit browser
IE.Quit znicit objekt
Set IE = Nothing
je-li SetUpQuant = 0 nevytvori se ani instance internet exploreru
none of them
zprava = "The requested
SKU/SKUs is/are not on
the BestBuy PC PL"
kontrola, ze nenastala
chyba logovani do IE,
ale SetUpQuant
je opravdu 0
done_3 = True
pri cteni souboru muze
teoreticky nastat
nasledujici
«1
»8 »7
** 4 **
** 5 **
** 6 **
End For
Yes
No
End For
End For
End For
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
End For
Yes No
Yes
No
Yes
No
Yes
No
End For
Yes
No
End For
Yes
No
Yes
No
End For
Yes
Yes
Yes
Yes
Yes
Else
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Else
Yes
No
Yes
No
End For
Yes
No
End For
Yes
No
Yes
No
Yes
No
Yes
No
12. Workbooks(filePL).Sheets
(PLtab).Activate
vybere napriklad bunku F2
Range(SkuColRange1).Select
SKU = ActiveCell.FormulaR1C1
(SKU <> SKUtoBeSetUp)
And (SKU <> Empty) ?
pokud nalezne tak vyfiltruje cely radek z PL do makro workbooku
ale ne pomoci copy paste, nybrz jako odkaz z workbooku na PL,
tim ze vlozi nejaky dynamicky utvareny string zacinajici rovnitkem
ActiveCell.Offset(1, 0).Select
SKU = ActiveCell.FormulaR1C1
SKU = SKUtoBeSetUp ?
R = ActiveCell.Row
nebudeme kopirovat cely aktivni radek najednou z PL do workbooku
Range(R & ":" & R).Copy
ale zaplnime workbook postupne odkazy na PL bunky
Windows(C_myMacroFile).Activate
w = w + 1
Sheets(C_myMacroSheet).Range("A15").Select
ActiveCell.Offset(w, 0).Select
myCellAdd = ArrOfRQSkuCELL(w - 1)
For pozice = 1 To
ColQuant Step 1
Range("A2").Select
y = y + 1
ActiveCell.Offset(y, 0).Select
SKUtoBeSetUp = ActiveCell.FormulaR1C1
ColNo = ActiveCell.Column
Header = ArrHeaders(pozice - 1)
jestlize je "Date" v
headeru pak
Format bude datum
InStr(1, Header,
"Date") <> 0 ?
pozice < 27 ?
Selection.NumberFormat
= "mm/dd/yy"
InStr(1, Header,
C_UPC) <> 0 ?
Selection.NumberFormat
= "0"
need to be Formated as
general (not
specified), otherwise
Selection.NumberFormat = "GENERAL"
Formulae End up as text
ColNo >= ColNoSku ?
ColLetter =
Mid(ActiveCell.Address,
2, 1)
pro pripad $F$1 a nize
budeme operovat s
promennou SKUColLetter,
tj pismeno sloupce
teoreticky pro $AA$1
ColLetter =
Mid(ActiveCell.Address,
2, 2)
ActiveCell.Offset(0,
1).Select
ColNo = ColNoSku ?
myCellAdd =
SKUColLetter & "$" & R
SKUColLetter = ColLetter
vlookupPAR3 = ColNo - ColNoSku + 1
cellTEXT = "=vlookup(" & myCellAdd & "," & uv & "[" & Qfile & "]" & PLtab & uv & "!" &
SKUColLetter & ":" & ColLetter & "," & vlookupPAR3 & ",0)"
ActiveCell.Value = cellTEXT
Duv = Chr$(34)
cellTEXT = "=INDIRECT(CONCATENATE(" & Duv & uv & "[" & Qfile & "]" & PLtab & uv & "!" & Duv &
", ADDRESS(MATCH(" & myCellAdd & "," & uv & "[" &
Qfile & "]" & PLtab & uv & "!" & SKUColLetter & ":" &
SKUColLetter & ",0), MATCH(" & Duv & Header & Duv & ","
& uv & "[" & Qfile & "]" & PLtab & uv & "!$A$1:$" &
ArrVirtualColumnLetters(ColQuant - 1) & "$1,0))))"
ActiveCell.Value = cellTEXT
Next pozice
Windows(C_myMacroFile).Activate
Range("A2").Select
y = y + 1
ActiveCell.Offset(y, 0).Select
SKUtoBeSetUp = ActiveCell.FormulaR1C1
!!!
w = w + 1
notSetUpQuant = notSetUpQuant + 1
«2
** 3 **
Yes No
Yes
No
End For
Yes
No
Yes
No
Yes
No
Yes No
Yes
No
13. Select Case kategorie
Warranty decision block
***********************
"Input_Devices-Game_
Controller" ?
"Input_Devices-Keyboards"
?
.getElementById("_
215127057_0_426000597_0_
351613033_0").Value
= "Kristi Baso"
"Input_Devices-Mice" ?
.getElementById("_
215127057_0_426000597_0_
351613033_0").Value
= "Kristi Baso"
"Web Cams" ?
.getElementById("_
215127057_0_426000597_0_
351613033_0").Value
= "Kristi Baso"
"Input_Devices
-Notebook_Mice" ?
.getElementById("_
215127057_0_426000597_0_
351613033_0").Value
= "Kristi Baso"
"Accessories" ?
.getElementById("_
215127057_0_426000597_0_
351613033_0").Value
= "Katie Penza"
"XBOX_Console" ?
.getElementById("_
215127057_0_426000597_0_
351613033_0").Value
= "David Arndt"
"PC_SW_non-VG" ?
.getElementById("_
215127057_0_426000597_0_
351613033_0").Value
= "David Arndt"
"VG_PC_SW" ?
.getElementById("_
215127057_0_426000597_0_
351613033_0").Value
= "Huan Nguyen"
"XBOX_SW" ?
.getElementById("_
215127057_0_426000597_0_
351613033_0").Value
= "Ed Hewitt"
"Zune" ?
.getElementById("_
215127057_0_426000597_0_
351613033_0").Value
= "Jenna Susko"
"Zune_Accessories" ?
.getElementById("_
215127057_0_426000597_0_
351613033_0").Value
= "Tom Kluis"
.getElementById("_
215127057_0_426000597_0_
351613033_0").Value =
"Charles Murray"
.getElementById("_
215127057_0_263500921_0_
318388927_0")
.selectedIndex = 2
InStr(1, kategorie,
"SW") <> 0 ?
** Sample Sent
days
Warranty Labour Days/Years
.getElementById("_
215127057_0_263500921_0_
1935191691_0").Value = 90
days
Warranty Parts Days/Years
.getElementById("_
215127057_0_263500921_0_
434903867_0").Value = 90
years
.getElementById("_
215127057_0_263500921_0_
158089848_0").Value = 3
years
.getElementById("_
215127057_0_263500921_0_
577627864_0").Value = 3
.all.Item("_215127057_0_
224502806_0_1599375785_
0").selectedIndex = 1
******* SAVE GENERAL
**********************
.all.Item("PC_7_0_J3_SAVE").Click
Call is_busy(IE)
********* SUPPLIER TAB
*************************
************************
.getElementById("tab2").Click
Call is_busy(IE)
** determining MSFT Xbox
or Microsoft algorithm
(from the file name)
InStr(1, C_myMacroFile,
"XBox") <> 0 ?
Private Label
Indicator = No
.all.Item("_1552681051_0_
1865545603_0_326364010_
0").Value = "Microsoft
Xbox Corporation"
.all.Item("_1552681051_0_
1865545603_0_326364010_
0").Value = "Microsoft"
.all.Item("_1552681051_0_
2143843476_0_198836717_
0").selectedIndex = 1
Primary Origin Country Indicator = Yes --- BY DEFAULT
IE.document.all.Item("_1552681051_0_1053610938_0_259351390_0").selectedIndex = 2
Country of Origin for BBY Purchase = United States --- BY DEFAULT
IE.document.all.Item("_1552681051_0_1053610938_0_190972293_0").value = United States
For j = 0 To ColQuant - 1
******* SAVE SUPPLIER
TAB ****************
ArrHeaders(j)
= C_NetPrice ?
Unit Cost
.getElementById("_
1552681051_0_1053610938_
0_1408138848_0_
1499822074_0").Value =
MatrixPLfltrd(i, j)
Next j
.all.Item("PC_7_0_J3_SAVE").Click
Call is_busy(IE)
********* LOGISTICS TAB
*************************
************************
.getElementById("tab3").Click
Call is_busy(IE)
»9
** 7 **
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Else
Yes
No
Yes
No
End For
Yes
No
15. ** Unit Dimensions and Weight *******************
a. Length or Depth = MS Unit Width
b. Width = MS Unit Depth
c. Height = MS Unit Length
d. Dimensions UOM = IN (choose from the drop down)
e. Weight = MS Unit Weight
f. Weight UOM = LB (choose from the drop down)
For j = 0 To ColQuant - 1
UOM - IN or LB
For unit and MP
Select Case ArrHeaders(j)
C_Un_Width ?
C_Un_Depth ?
For iii = 0
To 2
.getElementById("_
1715640154_0_553772606_"
& iii & "_1269885005_0")
.Value =
MatrixPLfltrd(i, j)
Next iii
C_Un_Length ?
For iii = 0
To 2
.getElementById("_
1715640154_0_553772606_"
& iii & "_267338521_0")
.Value =
MatrixPLfltrd(i, j)
Next iii
C_Un_Weight ?
For iii = 0
To 2
.getElementById("_
1715640154_0_553772606_"
& iii & "_735435212_0")
.Value =
MatrixPLfltrd(i, j)
Next iii
Else
For iii = 0
To 2
.getElementById("_
1715640154_0_553772606_"
& iii & "_305997947_0")
.Value =
MatrixPLfltrd(i, j)
Next iii
Next j
For iii = 0
To 3
** Master Pak Dimensions
and Weight ***********
.all.Item("_1715640154_0_553772606_" &
iii & "_354836947_0").selectedIndex = 3
.all.Item("_1715640154_0_553772606_" &
iii & "_434201048_0").selectedIndex = 3
Next iii
For j = 0 To ColQuant - 1
****** Inner, MPQ, TI, HI, IND ****************************
Inner Pack - Number of Eaches = Always 1
Select Case ArrHeaders(j)
C_MP_Length ?
C_MP_Depth ?
.getElementById("_
1715640154_0_553772606_3_
1269885005_0").Value =
MatrixPLfltrd(i, j)
C_MP_Width ?
.getElementById("_
1715640154_0_553772606_3_
267338521_0").Value =
MatrixPLfltrd(i, j)
C_MP_Weight ?
.getElementById("_
1715640154_0_553772606_3_
735435212_0").Value =
MatrixPLfltrd(i, j)
.getElementById("_
1715640154_0_553772606_3_
305997947_0").Value =
MatrixPLfltrd(i, j)
Next j
.getElementById("_
1715640154_0_662665405_0_
1898596981_0").Value = 1
For j = 0 To ColQuant - 1
Call pvtus_SQL_dotaz(TI, HI, current_SKU)
.getElementById("_1715640154_0_662665405_0_1795435815_0").Value = TI
.getElementById("_1715640154_0_662665405_0_1163388972_0").Value = HI
Case Pack - Number of
Eaches = Masterpack Qty
ArrHeaders(j) = C_MPQ ?
Pallet - Number of Eaches
.getElementById("_
1715640154_0_662665405_0_
1429791177_0").Value =
MatrixPLfltrd(i, j)
ArrHeaders(j) =
C_PalletQuantity ?
.getElementById("_
1715640154_0_662665405_0_
400926649_0").Value =
MatrixPLfltrd(i, j)
Next j
One Way Ind = NO --- BY DEFAULT in HTML
BBY Direct Import Ind = No
.all.Item("_1715640154_0_
81096678_0_552511319_0")
.selectedIndex = 1
******* SAVE Logistics
Tab ***************
.all.Item("PC_7_0_J3_SAVE").Click
Call is_busy(IE)
********* DATES TAB
*************************
************************
.getElementById("tab4").Click
Call is_busy(IE)
»10
** 9 **
End For
Yes
Yes
End For
Yes
End For
Yes
End For
End For
End For
End For
Yes
Yes
Yes
Yes
Else
End For
Yes
No
Yes
No
16. the VBA code cannot see the ID in HTML, so
we will use getElementsByTagName("input")
the indexed order of the input element is 108, starting from 0
slashQ = 0
MM = ""
DD = ""
YY = ""
nechceme Format(Time,
"hh:mm:ss AMPM")
MyTime = Format(Time,
"hh:mm:ss")
MyTime = Mid(MyTime, 1, 8) v pripade, ze by
to bylo deklarovano: Dim MyTime As Date, pak
implicitne pridava AM/PM nezavisle na Formatu,
proto je to Dimenzovano MyTime As String
For j = 0 To ColQuant - 1
BBuy_win = FindWindow(ByVal vbNullString, ByVal "Best Buy PIM
Portal - Windows Internet Explorer")
Call SetFocusAPI(ByVal BBuy_win)
ArrHeaders(j) = C_MSD ?
Len(MatrixPLfltrd(i,
j)) <> 0 ?
For iii = 1 To
Len(MatrixPLfltrd(i, j))
Len(MM) = 1 ?
Mid(MatrixPLfltrd(i, j),
iii, 1) <> "/"
And slashQ = 0 ?
Mid(MatrixPLfltrd(i, j),
iii, 1) <> "/"
And slashQ = 1 ?
MM = MM +
Mid(MatrixPLfltrd(i,
j), iii, 1)
Mid(MatrixPLfltrd(i, j),
iii, 1) <> "/"
And slashQ = 2 ?
DD = DD +
Mid(MatrixPLfltrd(i,
j), iii, 1)
Mid(MatrixPLfltrd(i, j),
iii, 1) = "/" ?
YY = YY +
Mid(MatrixPLfltrd(i,
j), iii, 1)
slashQ = slashQ + 1
Next iii
Len(DD) = 1 ?
MM = "0" + MM
.getElementsByTagName("Form")(0).getElementsByTagName
("input")(108).Value = YY & "-" & MM &
"-" & DD & " " & MyTime
DD = "0" + DD
Next j
For j = 1 To
300
******* SAVE Dates Tab
*******************
Call PostMessage(ByVal BBuy_win, ByVal
WM_KEYDOWN, ByVal VK_TAB, ByVal 0&)
Call PostMessage(ByVal BBuy_win, ByVal
WM_KEYUP, ByVal VK_TAB, ByVal 0&)
ms
Sleep 100
Next j
.all.Item("PC_7_0_J3_SAVE").Click
Call is_busy(IE)
********* Category TAB
*************************
************************
.getElementById("tab5").Click
Call is_busy(IE)
values of category attributes are stored
in the MarketingMatrix - without a header
go through the array ArrMarketDataHeaders and find the header and his
position - index and then refer to the relevant
index of the column in the MarketingMatrix
k = 0
Do While ArrMarketDataHeaders(k) <> "Operating system"
k = k + 1
Loop
IE.document.all.Item("_1562711832_0").selectedIndex
= MarketingMatrix(0, k)
Select Case kategorie
Case "PC_SW_non-VG"
Case "VG_PC_SW"
Case "Zune"
Case "Accessories" 'XBOX
Case "XBOX_Console"
Case "XBOX_SW"
Case "Input_Devices-Game_Controller"
Case "Input_Devices-Mice"
Case "Input_Devices-Keyboards"
Case "Web Cams"
End Select
first - we determine indices of some repeating
attributes to abbreviate the VBA code
vista(0) = "Bus"
vista(1) = "Basic"
vista(2) = "Prem"
vista(3) = "Ultim"
indx_vista = 0
determining of
operating system
k = 0
ArrMarketDataHeaders(k)
<> "Operating system" ?
Select Case
MarketingMatrix(i - 1, k)
k = k + 1
CPU_min(0) = 0#
CPU_min(1) = 1#
CPU_min(2) = 1.5
CPU_min(3) = 1.8
CPU_min(4) = 1.9
CPU_min(5) = 2#
CPU_min(6) = 2.5
CPU_min(7) = 3#
CPU_min(8) = 300#
CPU_min(9) = 400#
CPU_min(10) = 500#
CPU_min(11) = 600#
CPU_min(12) = 700#
CPU_min(13) = 800#
CPU_min(14) = 900#
CPU_min(15) = 1200#
"" ?
"Vista" ?
Not Applicable
index_OS = 6
Else
jen pripad pro
rozrazeni verzi Visty
For j = 7 To 13 Step 2
InStr(1,
MarketingMatrix(i - 1,
k), vista(indx_vista)) ?
indx_vista =
indx_vista + 1
index_OS = j
InStr(1,
MarketingMatrix(i
- 1, k), "64") ?
index_OS = j + 1
Next j
the rest is a combination of Vista/XP ->
prioritize XP (lower version) and for 95, 98 etc.
neberu v bunce ohled.
InStr(1,
MarketingMatrix(i
- 1, k), "XP") ?
index_OS = 16
if we do not have XP in
the offer, then select
Windows generally
index_OS = 15
CPU_min(16) = 1800#
CPU_rcmd(0) = 0#
CPU_rcmd(1) = 1#
CPU_rcmd(2) = 1.5
CPU_rcmd(3) = 2#
CPU_rcmd(4) = 2.5
CPU_rcmd(5) = 3#
CPU_rcmd(6) = 300#
CPU_rcmd(7) = 400#
CPU_rcmd(8) = 500#
CPU_rcmd(9) = 600#
CPU_rcmd(10) = 700#
CPU_rcmd(11) = 800#
CPU_rcmd(12) = 900#
CPU_rcmd(13) = 2500#
determining a
minimum frequency
k = 0
ArrMarketDataHeaders(k)
<> "Min Required
CPU Speed" ?
For j = 0 To
15
k = k + 1
Val(MarketingMatrix(i -
1, k)) >
CPU_min(UBound(CPU_min))
?
Val(MarketingMatrix(i -
1, k)) > CPU_min(j) And
Val(MarketingMatrix(i -
1, k)) <= CPU_min(j +1) ?
index_CPU_min = j + 2
Next j
DETERMINACE UOM -
UNIT OF MEASURE
index_CPU_min =
UBound(CPU_min) + 1
k = 0
ArrMarketDataHeaders(k)
<> "CPU Speed UOM" ?
»13 »12
** 10 **
** 11 **
End For
Yes
No
Yes
No
End For
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
End For
Yes
No
Yes
Yes
End For
Yes
No
Yes
No
Yes
No
Yes
No
End For
Yes
No Yes
No
Yes No