25
1 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 '@@@@@@@@@@@@ @@@@@@@@@@@ 5 '@@@@@ TITLE: SKU SET-UP APPLICATION FOR MICROSOFT SKU SET-UP PROCESS AT BEST BUY @@@@@@@@@@@ 6 '@@@@@@@@@@@@ @@@@@@@@@@@ 7 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9 '@@@@@@@@@@@@ @@@@@@@@@@@ 10 '@@@@ AUTHOR: Ales VYMYSLICKY @@@@@@@@@@@ 11 '@@@@ This entire code was written by the author and is an intellectual property of its author. 12 '@@@@@@@@@@@@ @@@@@@@@@@@ 13 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 14 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 15 '@@@@@@@@@@@@ @@@@@@@@@@@ 16 '@@@@@@@@@@@@ COPYRIGHT - ALES VYMYSLICKY @@@@@@@@@@@ 17 '@@@@@@@@@@@@ @@@@@@@@@@@ 18 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 19 '@@@@@@ USER: SKU SET-UP Team in Accenture at Microsoft Vermont Team, Prague, Czech Republic @ 20 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 21 '@@@@@@@@@@@@ Language: Visual Basic For Application 2007 @@@@@@@@@@@ 22 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 23 '@@@@@@@@@@@@ FILE NAME: SKU_set-up_Best Buy PC.xlsm @@@@@@@@@@@ 24 '@@@@@@@@@@@@ FILE FORMAT: MS EXCEL 2007 @@@@@@@@@@@ 25 '@@@@@@@@@@@@ DATE LAST MODIFIED: 2nd of April 2009 @@@@@@@@@@@ 26 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 27 '@@@@@@@@@@@@ DESCRIPTION: This is a workflow application SW With a holistic approach and thus 28 '@@@@@@@@@@@@ no user interaction is required. The MSFT SKU Set-Up process chore 29 '@@@@@@@@@@@@ carried out For Best Buy is abolished. The Former 45 minutes pensum of various 30 '@@@@@@@@@@@@ tasks is being replaced by this code, however an interaction With some 31 '@@@@@@@@@@@@ other applications and macros is required to achieve this level of automation. 32 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 33 '@@@@@@@@@@@@ @@@@@@@@@@@ 34 '@@@@@@@@@@@@ ASSOCIATED VB SCRIPTS: autoRAS.vbs @@@@@@@@@@@ 35 '@@@@@@@@@@@@ ASSOCIATED BATCH FILE: autoPING.bat @@@@@@@@@@@ 36 '@@@@@@@@@@@@ ASSOCIATED OUTLOOK MACRO: Project1_SKUSetUP.RunAScriptRuleRoutine @@@@@@@@@@@ 37 '@@@@@@@@@@@@ INPUT FILE: SKU_Set-Up_Tracking_Tool.xls @@@@@@@@@@@ 38 '@@@@@@@@@@@@ INPUT FILES: SKUsBEPC.txt, SKUsBEXB.txt, market_tech_DATA.xlsm @@@@@@@@@@@ 39 '@@@@@@@@@@@@ INPUT DIRECTORY: \\mslifsu\BIZ\ACNHED\HBI\OAMS\ @@@@@@@@@@@ 40 '@@@@@@@@@@@@ INPUT FILE: MMDDYY_MS_PC_Best Buy.xls @@@@@@@@@@@ 41 '@@@@@@@@@@@@ INPUT DIRECTORY: C:\Users\v-alvymy\Desktop\Automation\SKU set-up\Marketing_data 42 '@@@@@@@@@@@@ INPUT DATABASE: Data Source=Homedepot @@@@@@@@@@@ 43 '@@@@@@@@@@@@ INPUT CATALOG: Initial Catalog=AdHocReporting @@@@@@@@@@@ 44 '@@@@@@@@@@@@ OUTPUT WEB SITE: https://pimportal.bestbuy.com/wps/portal @@@@@@@@@@@ 45 '@@@@@@@@@@@@ OUTPUT E-MAIL: Outlook Mail @@@@@@@@@@@ 46 '@@@@@@@@@@@@ OUTPUT FILE: SKU_Set-Up_Tracking_Tool.xls @@@@@@@@@@@ 47 '@@@@@@@@@@@@ @@@@@@@@@@@ 48 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 49 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 50 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 51 52 Option Explicit 'VBA will not even execute a procedure 53 'If it contains an undeclared variable name 54 Private Declare Sub Sleep Lib "kernel32" _ 55 (ByVal dwMilliseconds As Long) 56 Private Declare Function FindWindow Lib "user32.dll" _ 57 Alias "FindWindowA" _ 58 (ByVal lpClassName As String, _ 59 ByVal lpWindowName As String) As Long 60 Private Declare Function SetFocusAPI Lib "user32.dll" _ 61 Alias "SetFocus" _ 62 (ByVal hwnd As Long) As Long 63 Private Declare Function PostMessage Lib "user32.dll" _ 64 Alias "PostMessageA" _ 65 (ByVal hwnd As Long, _ 66 ByVal wMsg As Long, _ 67 ByVal wParam As Long, _ 68 lParam As Any) As Long 69 Public filePL, zprava, MarketDataHeader, ArrMarketDataHeaders(), MarketingMatrix() As String 70 Public get_mailArrOfRQSku() As String ' mailArrOfRQSku je defacto ArrOfRQSku nize - dobre rozlisit 71 'pro event. pozdejsi rekognoskacni algr a verifikacni algr na kompatibilitu s PL nebo pvtus 72 Public get_subjSKUtoBeSetUpQuant, SetUpQuant, MarketDataColQuant As Byte 73 Public get_arr_of_set_up_SKU(), PIMId(), get_arr_of_UPC(), street_date As String 74 Public PL_OPEN, done_1, done_2 As Boolean 75 76 Public Const C_myMacroFile As String = "SKU_set-up_Best Buy PC.xlsm" '***************************** 77 Public Const C_myMarketData As String = "market_tech_DATA.xlsm" '********************************** 78 Public Const plocha As String = "C:\Users\v-alvymy\Desktop\Automation\SKU set-up\SKUattributes" '** 79 Public Const plocha2 As String = "C:\Users\v-alvymy\Desktop\Automation\SKU set-up\emailSKUinput" '* 80 Public Const soubor_na_plose As String = "SKUsBEPC.txt" '****************************************** 81 82 Public Const WM_KEYDOWN As Long = &H100 83 Public Const WM_KEYUP As Long = &H101 84 Public Const VK_TAB As Long = &H9

SKU_set-up_Best Buy PC

Embed Size (px)

Citation preview

1 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

2 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

3 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

4 '@@@@@@@@@@@@ @@@@@@@@@@@

5 '@@@@@ TITLE: SKU SET-UP APPLICATION FOR MICROSOFT SKU SET-UP PROCESS AT BEST BUY @@@@@@@@@@@

6 '@@@@@@@@@@@@ @@@@@@@@@@@

7 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

8 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

9 '@@@@@@@@@@@@ @@@@@@@@@@@

10 '@@@@ AUTHOR: Ales VYMYSLICKY @@@@@@@@@@@

11 '@@@@ This entire code was written by the author and is an intellectual property of its author.

12 '@@@@@@@@@@@@ @@@@@@@@@@@

13 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

14 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

15 '@@@@@@@@@@@@ @@@@@@@@@@@

16 '@@@@@@@@@@@@ COPYRIGHT - ALES VYMYSLICKY @@@@@@@@@@@

17 '@@@@@@@@@@@@ @@@@@@@@@@@

18 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

19 '@@@@@@ USER: SKU SET-UP Team in Accenture at Microsoft Vermont Team, Prague, Czech Republic @

20 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

21 '@@@@@@@@@@@@ Language: Visual Basic For Application 2007 @@@@@@@@@@@

22 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

23 '@@@@@@@@@@@@ FILE NAME: SKU_set-up_Best Buy PC.xlsm @@@@@@@@@@@

24 '@@@@@@@@@@@@ FILE FORMAT: MS EXCEL 2007 @@@@@@@@@@@

25 '@@@@@@@@@@@@ DATE LAST MODIFIED: 2nd of April 2009 @@@@@@@@@@@

26 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

27 '@@@@@@@@@@@@ DESCRIPTION: This is a workflow application SW With a holistic approach and thus

28 '@@@@@@@@@@@@ no user interaction is required. The MSFT SKU Set-Up process chore

29 '@@@@@@@@@@@@ carried out For Best Buy is abolished. The Former 45 minutes pensum of various

30 '@@@@@@@@@@@@ tasks is being replaced by this code, however an interaction With some

31 '@@@@@@@@@@@@ other applications and macros is required to achieve this level of automation.

32 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

33 '@@@@@@@@@@@@ @@@@@@@@@@@

34 '@@@@@@@@@@@@ ASSOCIATED VB SCRIPTS: autoRAS.vbs @@@@@@@@@@@

35 '@@@@@@@@@@@@ ASSOCIATED BATCH FILE: autoPING.bat @@@@@@@@@@@

36 '@@@@@@@@@@@@ ASSOCIATED OUTLOOK MACRO: Project1_SKUSetUP.RunAScriptRuleRoutine @@@@@@@@@@@

37 '@@@@@@@@@@@@ INPUT FILE: SKU_Set-Up_Tracking_Tool.xls @@@@@@@@@@@

38 '@@@@@@@@@@@@ INPUT FILES: SKUsBEPC.txt, SKUsBEXB.txt, market_tech_DATA.xlsm @@@@@@@@@@@

39 '@@@@@@@@@@@@ INPUT DIRECTORY: \\mslifsu\BIZ\ACNHED\HBI\OAMS\ @@@@@@@@@@@

40 '@@@@@@@@@@@@ INPUT FILE: MMDDYY_MS_PC_Best Buy.xls @@@@@@@@@@@

41 '@@@@@@@@@@@@ INPUT DIRECTORY: C:\Users\v-alvymy\Desktop\Automation\SKU set-up\Marketing_data

42 '@@@@@@@@@@@@ INPUT DATABASE: Data Source=Homedepot @@@@@@@@@@@

43 '@@@@@@@@@@@@ INPUT CATALOG: Initial Catalog=AdHocReporting @@@@@@@@@@@

44 '@@@@@@@@@@@@ OUTPUT WEB SITE: https://pimportal.bestbuy.com/wps/portal @@@@@@@@@@@

45 '@@@@@@@@@@@@ OUTPUT E-MAIL: Outlook Mail @@@@@@@@@@@

46 '@@@@@@@@@@@@ OUTPUT FILE: SKU_Set-Up_Tracking_Tool.xls @@@@@@@@@@@

47 '@@@@@@@@@@@@ @@@@@@@@@@@

48 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

49 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

50 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

51

52 Option Explicit 'VBA will not even execute a procedure

53 'If it contains an undeclared variable name

54 Private Declare Sub Sleep Lib "kernel32" _

55 (ByVal dwMilliseconds As Long)

56 Private Declare Function FindWindow Lib "user32.dll" _

57 Alias "FindWindowA" _

58 (ByVal lpClassName As String, _

59 ByVal lpWindowName As String) As Long

60 Private Declare Function SetFocusAPI Lib "user32.dll" _

61 Alias "SetFocus" _

62 (ByVal hwnd As Long) As Long

63 Private Declare Function PostMessage Lib "user32.dll" _

64 Alias "PostMessageA" _

65 (ByVal hwnd As Long, _

66 ByVal wMsg As Long, _

67 ByVal wParam As Long, _

68 lParam As Any) As Long

69 Public filePL, zprava, MarketDataHeader, ArrMarketDataHeaders(), MarketingMatrix() As String

70 Public get_mailArrOfRQSku() As String ' mailArrOfRQSku je defacto ArrOfRQSku nize - dobre rozlisit

71 'pro event. pozdejsi rekognoskacni algr a verifikacni algr na kompatibilitu s PL nebo pvtus

72 Public get_subjSKUtoBeSetUpQuant, SetUpQuant, MarketDataColQuant As Byte

73 Public get_arr_of_set_up_SKU(), PIMId(), get_arr_of_UPC(), street_date As String

74 Public PL_OPEN, done_1, done_2 As Boolean

75

76 Public Const C_myMacroFile As String = "SKU_set-up_Best Buy PC.xlsm" '*****************************

77 Public Const C_myMarketData As String = "market_tech_DATA.xlsm" '**********************************

78 Public Const plocha As String = "C:\Users\v-alvymy\Desktop\Automation\SKU set-up\SKUattributes" '**

79 Public Const plocha2 As String = "C:\Users\v-alvymy\Desktop\Automation\SKU set-up\emailSKUinput" '*

80 Public Const soubor_na_plose As String = "SKUsBEPC.txt" '******************************************

81

82 Public Const WM_KEYDOWN As Long = &H100

83 Public Const WM_KEYUP As Long = &H101

84 Public Const VK_TAB As Long = &H9

85

86 Public Sub Auto_Open()

87 With Application

88 .ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"

89 .CommandBars("Status Bar").Visible = False

90 '.CommandBars("Formating").Visible = False - not in this version

91 .DisplayFormulaBar = False

92 .DisplayScrollBars = False

93 '.Caption = " "

94 '.ActiveWindow.Caption = ""

95 .ActiveWindow.DisplayHeadings = False

96 '.ActiveWindow.DisplayWorkbookTabs = False

97 '.ActiveWindow.DisplayVerticalScrollBar = False - also possible

98 '.ActiveWindow.DisplayHorizontalScrollBar = False - also possible

99 .WindowState = xlNormal

100 End With

101 'dale zneviditelnime pripadne dalsi listy;

102 'jako: Security Warning - Automatic update of links has been disabled

103 Dim theBar As CommandBar

104 For Each theBar In Application.CommandBars

105 On Error Resume Next

106 theBar.Enabled = False

107 Next

108

109 Call readMailTXT(get_mailArrOfRQSku, get_subjSKUtoBeSetUpQuant)

110 Call SetupBestBuy

111 Call Notification_Email(get_arr_of_set_up_SKU, PIMId, get_arr_of_UPC, ArrMarketDataHeaders,

MarketingMatrix)

112 Call Save_Exit

113 End Sub

114 Public Sub Auto_Close()

115 With Application

116 .ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",True)"

117 .CommandBars("Status Bar").Visible = True

118 '.CommandBars("Formating").Visible = True - not in this version

119 .DisplayFormulaBar = True

120 .DisplayScrollBars = True

121 .ActiveWindow.DisplayHeadings = True

122 .ActiveWindow.DisplayWorkbookTabs = True

123 '.ActiveWindow.DisplayVerticalScrollBar = True - also possible

124 '.ActiveWindow.DisplayHorizontalScrollBar = True - also possible

125 '.Caption = Empty

126 '.ActiveWindow.Caption = False

127 .WindowState = xlNormal

128 End With

129 'opet zviditelnime pripadne dalsi listy;

130 'jako: Security Warning - Automatic update of links has been disabled

131 Dim theBar As CommandBar

132 For Each theBar In Application.CommandBars

133 On Error Resume Next

134 theBar.Enabled = True

135 Next

136 End Sub

137 Public Sub Save_Exit()

138 Application.DisplayAlerts = False

139 If PL_OPEN = True Then

140 Application.Workbooks(filePL).Close SaveChanges:=False

141 End If

142 Application.Workbooks(C_myMacroFile).Activate

143 Application.Workbooks(C_myMacroFile).Save

144 Application.Quit

145 End Sub

146 'VBA MACRO - TOOLS - REFERENCES - BROWSE - go to WINDOWS\SYSTEM32\shdocvw.dll

147 '(will add MICROSOFT INTERNET CONTROL - TICK THIS OPTION)

148 'Function uses the SHDocVw.ShellWindows object to iterate the running IE instances

149 Public Function GetOpenIEByURL(ByVal pop_up_URL As String) As SHDocVw.InternetExplorer

150 Dim objShellWindows As New SHDocVw.ShellWindows

151 'ignore errors when accessing the document property

152 On Error Resume Next

153 'Loop over all Shell-Windows

154 For Each GetOpenIEByURL In objShellWindows

155 'If the document is of type HTMLDocument, it is an IE window

156 If TypeName(GetOpenIEByURL.Document) = "HTMLDocument" Then

157 'check the URL

158 If GetOpenIEByURL.Document.URL = pop_up_URL Then

159 'leave, we found the right window

160 Exit Function

161 End If

162 End If

163 Debug.Print TypeName(GetOpenIEByURL.Document)

164 Next

165 End Function

166 Private Function GetXLCol(ByVal Col As Integer) As String

167 ' Col is the present column, not the number of cols

168 Const A = 65 'ASCII value For capital A

169 Dim iMults As Integer

170 Dim sCol As String

171 Dim iRemain As Integer

172 ' THIS ALGORITHM ONLY WORKS UP TO ZZ. It fails on AAA

173 If Col > 701 Then

174 GetXLCol = ""

175 Exit Function

176 End If

177 If Col <= 25 Then

178 sCol = Chr(A + Col)

179 Else

180 iRemain = Int((Col / 26)) - 1

181 sCol = Chr(A + iRemain) & GetXLCol(Col Mod 26)

182 End If

183 GetXLCol = sCol

184 End Function

185 Sub readMailTXT(mailArrOfRQSku, subjSKUtoBeSetUpQuant)

186 Dim mailSubject, t As String

187 Dim subjCharNo As Long ', subjSKUtoBeSetUpQuant As Byte

188 Dim subjLength As Long

189 Dim krok As Byte

190 Dim is_num, not_num, std_chr, not_std As Boolean

191

192 Open plocha2 & "\" & soubor_na_plose For Input Access Read As #1

193 Do While Not EOF(1)

194 Input #1, mailSubject

195 Loop

196 subjLength = LOF(1)

197 Close #1

198 subjSKUtoBeSetUpQuant = 0

199 For subjCharNo = 4 To (subjLength - 5) '----00000 until the 4th position,

200 'the dash is not relevant

201 is_num = False

202 not_num = False

203 std_chr = False

204 not_std = False

205 If Mid(mailSubject, subjCharNo, 1) = "-" Then

206 For krok = 1 To 5 Step 1 'musi nasledovat ASCII code pro numericke znaky

207 t = Asc(Mid(mailSubject, subjCharNo + krok, 1))

208 If (48 <= t And t <= 57) Then

209 is_num = True

210 Else

211 not_num = True

212 End If

213 Next krok

214 For krok = 1 To 3 Step 1 'SKU vlevo musi byt znak z alfanumericke sady, male kapitalizuji

215 t = Asc(UCase(Mid(mailSubject, subjCharNo - 4 + krok, 1)))

216 If (48 <= t And t <= 57) Or (65 <= t And t <= 90) Then

217 std_chr = True

218 Else

219 not_std = True

220 End If

221 Next krok

222 If not_num = False And Not_std = False Then

223 ReDim Preserve mailArrOfRQSku(subjSKUtoBeSetUpQuant)

224 mailArrOfRQSku(subjSKUtoBeSetUpQuant) = UCase(Mid(mailSubject, (subjCharNo - 3), 9)) 'SKU je

devitimistne

225 subjSKUtoBeSetUpQuant = subjSKUtoBeSetUpQuant + 1

226 Debug.Print Mid(mailSubject, (subjCharNo - 3), 9)

227 Debug.Print mailArrOfRQSku(subjSKUtoBeSetUpQuant - 1)

228 End If

229 End If

230 Next subjCharNo

231 End Sub

232 Sub Notification_Email(ByVal get_arr_of_set_up_SKU, ByVal PIMId, ByVal get_arr_of_UPC, ByVal

ArrMarketDataHeaders, ByVal MarketingMatrix)

233 ' Is working in Office 2000-2007

234 Dim OL_App As Object

235 Dim OL_Mail As Object

236 Dim mailSubject, mailBody_part1, mailBody_part2, mailBody_part3, mailBody_partX, signature As String

237 Dim m, n, p As Byte

238 Dim message As Boolean

239 Dim photographs() As String

240

241 p = 0

242 Application.DisplayAlerts = False

243 On Error GoTo Chyby2: 'chyba subscript out of range u pole get_arr_of_set_up_SKU nastane,

244 ' kdyz nejsme narasovani. Otevirani PL vrati chybu pak se spusti tato proced.

245 ' s nenaDimenzovanymi poli, ktera vraci dalsi chybu -> ukoncime makro a -> RAS

246 Set OL_App = CreateObject("Outlook.Application")

247 OL_App.Session.Logon

248 Set OL_Mail = OL_App.CreateItem(0)

249

250 message = False

251 If SetUpQuant <> 0 And done_1 = True Then

252 mailBody_part1 = "Hello everyone," & vbNewLine & vbNewLine & _

253 "Please be inFormed that the "

254

255 If UBound(get_arr_of_set_up_SKU) < 1 Then

256 mailBody_part2 = "item below has been set up on the PIM portal:" & vbNewLine & vbNewLine

257 Else

258 mailBody_part2 = "items below have been set up on the PIM portal:" & vbNewLine & vbNewLine

259 End If

260 mailSubject = ""

261 mailBody_part3 = ""

262 For m = 0 To UBound(get_arr_of_set_up_SKU)

263 mailSubject = mailSubject & get_arr_of_set_up_SKU(m) & " ; "

264 mailBody_partX = "This is the PIM Id# " & PIMId(m) & vbNewLine & _

265 "This is the UPC# " & get_arr_of_UPC(m) & vbNewLine & _

266 "This is the SKU# " & get_arr_of_set_up_SKU(m) & vbNewLine & vbNewLine

267 mailBody_part3 = mailBody_part3 & mailBody_partX

268 For n = 0 To UBound(ArrMarketDataHeaders)

269 If ArrMarketDataHeaders(n) = "1st Image" Or ArrMarketDataHeaders(n) = "2nd Image" Then

270 ReDim Preserve photographs(p)

271 photographs(p) = MarketingMatrix(m, n)

272 p = p + 1

273 End If

274 Next n

275 Next m

276 message = True

277 ElseIf done_2 = True Then

278 mailBody_part1 = zprava & vbNewLine & vbNewLine 'nic z toho nemohlo byt naset-upovano

279 '(neni na PL), mohou nastat pripady: vse bylo udelano, nic nebylo udelano, neco z toho

280 'bylo udelano, neco bylo udelano a zbytek neni na PL, do budoucna pripad bylo udelano drive

281 message = True

282 End If

283 signature = "Regards," & vbNewLine & vbNewLine & _

284 "Ales Vymyslicky (Accenture)" & vbNewLine & _

285 "E&D NAOC Transaction Team" & vbNewLine & _

286 "tel: + 420 225 042 496" & vbNewLine & _

287 "e-mail: [email protected]"

288 On Error Resume Next

289 If message = True Then

290 With OL_Mail

291 .SentOnBehalfOfName = "[email protected]" '"[email protected]"

292 .To = "[email protected]; [email protected]"

293 .CC = "[email protected]"

294 .BCC = ""

295 .Subject = "SKU set-up notification for the " & mailSubject

296 .Body = mailBody_part1 & mailBody_part2 & mailBody_part3 & signature

297 For p = 0 To UBound(photographs)

298 .Attachments.Add (photographs(p))

299 Next p

300 .Display 'or use .Send straight away

301 End With

302 End If

303 On Error GoTo 0

304

305 Set OL_Mail = Nothing

306 Set OL_App = Nothing

307 Exit Sub

308 Chyby2:

309 Application.DisplayAlerts = False

310 Application.Quit

311 End Sub

312 Private Sub is_busy(ByVal internet)

313 With internet

314 Do While .Busy: DoEvents: Loop

315 Do While .ReadyState <> 4: DoEvents: Loop

316 End With

317 Application.Wait (Now + TimeValue("0:00:3"))

318 End Sub

319 Sub pvtus_SQL_dotaz(tier, layer, ByVal current_SKU)

320 Dim objConnection As Object

321 Dim objRecordset As Object

322 Dim PartN, strSQL As String

323 Set objConnection = CreateObject("ADODB.Connection")

324 Set objRecordset = CreateObject("ADODB.Recordset")

325 PartN = "'" & current_SKU & "'"

326 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"

327 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 & ")"

328 objRecordset.Open strSQL, objConnection

329 tier = objRecordset.Fields.Item("PalletTie").Value

330 layer = objRecordset.Fields.Item("PalletLayers").Value

331 'pom = objRecordset.Fields.Item("PartNumber").Value

332 End Sub

333 Sub SetupBestBuy()

334 Dim pathPL, pathTmplt, fileTmplt, SKUSetUpFileName, Qfile, typeselection As String

335 Dim PLtab, SKUColLetter, ColLetter, uv, Duv, ID As String

336 Dim ColNoSku, ColNo, ColQuant, SKUtoBeSetUpQuant, notSetUpQuant, pozice, vlookupPAR3 As Byte

337 Dim myCellAdd As String: Dim myCellContent As Variant

338 'SetUpQuant udava SKUtoBeSetUpQuant - notSetUpQuant(realna-co je na PL)

339 'SetUpQuant udava pri Dimenzovani MatrixPLfltrd index radku vcetne zahlavi

340 Dim R, w, y, z As Integer

341 Dim MyDate As Date

342 Dim MyTime As String

343 Dim MyDay As Byte

344 Dim MyMonth As Byte

345 Dim MyYear As Integer

346 Dim MM, DD, YY As String

347 Dim filePLSubstringIND, increment, i, iii, k, u, v, SetUpRowFltrd, TI, HI As Byte

348 Dim j, jj As Integer

349 Dim Header, cellTEXT, RQSkuCELL, SKUtoBeSetUp, SKU, SkuColRange1, incstring As String

350 Dim Response As VbMsgBoxResult

351 Dim ArrHeaders() As String

352 Dim MatrixPLfltrd() As Variant 'bude nacitat ruzne cis Formaty, aby se pak dodrzely

353 Dim ArrOfRQSku(), ArrOfRQSkuCELL(), current_SKU As String

354 Dim ArrOfPLind() As Boolean

355 Dim ArrVirtualColumnLetters() As String

356 Dim IE, pop_up As Object: Dim pop_up_URL, super_html_kategorie, html_kategorie As String

357 Dim kategorie, pole_kategorii_L1(3), pole_kategorii_L2(3), pole_kategorii_L3(2) As String

358 Dim ColNoItemName, ColNoLegalName, ColNoBusUnit, ColNoDivName, ColNoProType As Byte

359 Dim Index, slashQ As Byte

360 Dim done, done_3 As Boolean

361 Dim BBuy_win As Long

362 '******************************************************************************************

363 Const pathPL_C1 = "\\mslifsu\BIZ\ACNHED\HBI\OAMS\"

364 Const pathPL_C2 = " PC Price Lists"

365 Const FDQuote = "_MS_PC_Best Buy.xls" 'pro ucely Formula row, kde pridava Excel

366 've slove Fry's jeste jeden quote na vic

367 '******************************************************************************************

368 Const C_LegalName = "ItemLegalName"

369 Const C_ItemName = "ItemName": Const C_PartNumber = "PartNumber": Const C_MSSKU = "PartNumber"

370 Const C_SubString = "Best": Const C_myMacroSheet = "SKU to be set up"

371 Const C_MSD = "MicrosoftShipDate"

372 Const C_DateDiscontinued = "DateDiscontinued"

373 Const C_StartEffectiveDate = "StartEffectiveDate"

374 Const C_EndEffectiveDate = "EndEffectiveDate"

375 Const C_UPC = "UPC": Const C_MPQ = "MasterPakQuantity": Const C_PalletQuantity = "PalletQuantity"

376 Const C_NetPrice = "NetPrice": Const C_MSRP = "RecommendedRetailPrice"

377 Const C_Un_Weight = "EstUnitWeight_lbs"

378 Const C_Un_Length = "UnitLength_in":

379 Const C_Un_Width = "UnitWidth_in"

380 Const C_Un_Depth = "UnitDepth_in"

381 Const C_MP_Weight = "EstMasterPakWeight_lbs"

382 Const C_MP_Length = "MasterPakLength_in"

383 Const C_MP_Width = "MasterPakWidth_in"

384 Const C_MP_Depth = "MasterPakDepth_in"

385 Const C_BusUnit = "BusinessUnit"

386 Const C_DivName = "DivisionName"

387 Const C_ProType = "ProductType"

388 '*************************************

389 Const C_PIMPORTAL_LOGIN = "https://pimportal.bestbuy.com/wps/portal"

390 Const C_element_userID = "userID" 'input field

391 Const C_element_password = "password" 'input field

392 Const C_element_PC_7_0_64__login = "PC_7_0_64__login" 'login button

393 Const C_myID = "v000348": Const C_myPW = "Abcde007"

394

395 PLtab = "Price List Report"

396

397 'Application.OnTime Now + TimeValue("00:30:00"), "Save_Exit" 'autotermination

398 'If error and no response in 30 mins Then autotermination, however problem With

399 'multiple set-ups - how long period? For 6 SKUs, maybe 3 hours. For 1 Sku, 30 min

400 'Saving to Best Buy database via portal is extremely slow -> 1 set-up takes 25 min

401 'reseni: cas, za ktery nastane autoterminace by se mohl menit = SetUpQuant * 30 min

402

403 MyDate = Date ' MyDate contains the current system date.

404 MyDay = Day(MyDate)

405 MyMonth = Month(MyDate)

406 MyYear = Year(MyDate)

407 YY = MyYear Mod 100

408 YY = "0" & YY

409 If MyMonth < 10 Then

410 MM = "0" & MyMonth

411 Else

412 MM = MyMonth

413 End If

414

415 If MyDay >= 15 Then

416 DD = "15"

417 Else

418 DD = "01"

419 End If

420 '**********************************************************************************

421 '***** Tracking down the latest pathPL and actual filePL name *** (or the 2nd latest)**

422 '***** IT Connection Manager must be connected via RAS Card !!! *******************

423 On Error GoTo Chyby

424 pathPL = pathPL_C1 & MM & DD & YY & pathPL_C2

425 typeselection = "\*.xls"

426 filePL = Dir(pathPL & typeselection, vbReadOnly) 'the first listed filePL will be loaded into the filePL

string variable otherwise an Empty string

427 filePLSubstringIND = InStr(1, filePL, C_SubString) 'searching For the substring, returns 0 If not found

428 If filePLSubstringIND <> 0 Then 'alternatively, to be more specific: If filePLSubstringIND = 14 Then

429 Workbooks.Open Filename:=pathPL & "\" & filePL, ReadOnly:=True

430 PL_OPEN = True

431 Else

432

433 On Error GoTo PLnotReady

434

435 Do While filePLSubstringIND = 0 'account name starts always on the 14th character so it could be: Do

While filePLSubstringIND <> 14

436 filePL = Dir() ' read the Next filePL in the directory If there is none Then an Empty string will

be assigned

437 filePLSubstringIND = InStr(1, filePL, C_SubString)

438 If filePLSubstringIND <> 0 Then

439 Workbooks.Open Filename:=pathPL & "\" & filePL, ReadOnly:=True

440 PL_OPEN = True

441 End If

442 Loop

443 '***** Tracking down the 2nd latest PL pathPL and its name If filePLSubstringIND = 0 ***************

444 '***** from now on it will continue With opening the PL belonging to the previous period

445 PLnotReady:

446 If filePLSubstringIND = 0 Then

447 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)

448 If Response = vbYes Then 'If NO - GOTO chyby, PL neni dostupny, see Else na radku 106

449

450 If MyDay >= 15 Then '***** start reading the PL from the preceding period *****

451 DD = "01"

452 pathPL = pathPL_C1 & MM & DD & YY & pathPL_C2

453 typeselection = "\*.xls"

454 filePL = Dir(pathPL & typeselection, vbReadOnly) 'the first listed filePL will be loaded

into the filePL string variable otherwise an Empty string

455 filePLSubstringIND = InStr(1, filePL, C_SubString)

456

457 If filePLSubstringIND <> 0 Then

458 Workbooks.Open Filename:=pathPL & "\" & filePL, ReadOnly:=True

459 PL_OPEN = True

460 Else

461

462 On Error GoTo Chyby

463

464 Do While filePLSubstringIND = 0

465 filePL = Dir()

466 filePLSubstringIND = InStr(1, filePL, C_SubString)

467 If filePLSubstringIND <> 0 Then

468 Workbooks.Open Filename:=pathPL & "\" & filePL, ReadOnly:=True

469 PL_OPEN = True

470 End If

471 Loop

472 End If

473

474 Else

475 DD = "15"

476 If MyMonth <= 10 Then

477 If MyMonth = 1 Then

478 MM = "12"

479 YY = (MyYear Mod 100) - 1

480 YY = "0" & YY

481 Else

482 MyMonth = MyMonth - 1

483 MM = "0" & MyMonth

484 End If

485 Else

486 MyMonth = MyMonth - 1

487 MM = MyMonth

488 End If

489 pathPL = pathPL_C1 & MM & DD & YY & pathPL_C2

490 typeselection = "\*.xls"

491 filePL = Dir(pathPL & typeselection, vbReadOnly) 'the first listed filePL will be loaded

into the filePL string variable otherwise an Empty string

492 filePLSubstringIND = InStr(1, filePL, C_SubString)

493 If filePLSubstringIND <> 0 Then

494 Workbooks.Open Filename:=pathPL & "\" & filePL, ReadOnly:=True

495 PL_OPEN = True

496 Else

497

498 On Error GoTo Chyby

499

500 Do While filePLSubstringIND = 0 'account name starts always on the 14th character

501 filePL = Dir() ' read the Next filePL in the directory If there is none Then an Empty

string will be assigned

502 filePLSubstringIND = InStr(1, filePL, C_SubString)

503 If filePLSubstringIND <> 0 Then

504 Workbooks.Open Filename:=pathPL & "\" & filePL, ReadOnly:=True

505 PL_OPEN = True

506 End If

507 Loop

508 End If

509 End If

510 Else: GoTo Chyby '***** Else response is vbNo

511 End If

512 End If 'If PL is not Ready

513 End If

514 '*********************************************************************************

515 '***** How many arrays are there on the PL? + Loading the headers into an array + Searching For the PartNumber

Header *******

516 Application.ScreenUpdating = False

517 Workbooks(filePL).Sheets(PLtab).Activate '!!! nutno aktivovat spravny tab !!!

518 Range("A1").Select

519 Header = ActiveCell.FormulaR1C1

520 ColQuant = 0

521 Do While Header <> Empty

522 ColQuant = ColQuant + 1

523 ColNo = ActiveCell.Column

524 ReDim Preserve ArrHeaders(ColQuant - 1)

525 ArrHeaders(ColQuant - 1) = Header

526 ReDim Preserve ArrVirtualColumnLetters(ColQuant - 1)

527

528 If ColNo < 27 Then

529 ColLetter = Mid(ActiveCell.Address, 2, 1)

530 If Header = C_MSSKU Then

531 SKUColLetter = Mid(ActiveCell.Address, 2, 1)

532 ColNoSku = ColNo

533 End If

534 Else

535 ColLetter = Mid(ActiveCell.Address, 2, 2) 'teoreticky pro $AA$1

536 If Header = C_MSSKU Then

537 SKUColLetter = Mid(ActiveCell.Address, 2, 1)

538 ColNoSku = ColNo

539 End If

540 End If

541

542 ArrVirtualColumnLetters(ColQuant - 1) = ColLetter

543 ' virtual - slupec nemusi existovat, pocet se muze menit

544 ActiveCell.Offset(0, 1).Select

545 Header = ActiveCell.FormulaR1C1

546 Loop

547 'MID is a text Function and it returns a specific number of characters from a text

548 'string, starting at the position you specify, based on the number of characters you specify

549 'ActiveCell.Address returns the address in $F$1 Format, so we need the position 2

550 '*****

551 '*********************************************************************************

552 '***** Refreshing the "Is the SKU on the PL? " CELLS - Column B ******************

553 '***** according to the latest MM DD YY Tiger's PL *********************************

554 Windows(C_myMacroFile).Activate

555 Sheets(C_myMacroSheet).Range("A2:B12").Select

556 Selection.ClearContents

557 Qfile = MM & DD & YY & FDQuote

558 'Const FDQuote = "_MS_PC_Fry''s.xls" 'pro ucely Formula row - specifikum FRYS

559 'obsahujici apostrof

560 PLtab = "Price List Report"

561 uv = "'" 'prirazeni quote

562 Range("A1").Select

563 For increment = 0 To get_subjSKUtoBeSetUpQuant - 1

564 'zapsani vstupnich SKU z emailSKUinput\SKUsBEPC.txt do worksheetu

565 ActiveCell.Offset(increment + 1, 0).Value = get_mailArrOfRQSku(increment)

566 Next increment

567 Range("A2").Select

568 increment = 2

569 incstring = increment 'konvertuje byte na string automatickym prirazenim

570 RQSkuCELL = "A" & incstring

571 SKUtoBeSetUp = ActiveCell.FormulaR1C1

572 'osetreni chyb lze vynechat, v pripade chyby vraci vlookup do bunky #N/A , t.j. nenalezl

573 'On Error Resume Next

574 'Err.Clear

575 SKUtoBeSetUpQuant = 0

576 Do While SKUtoBeSetUp <> Empty

577 ReDim Preserve ArrOfRQSkuCELL(SKUtoBeSetUpQuant) '?je tam o jednu hodnotu navic v poli, nebudeme ji

potrebovat, je to adresa posledni (prazdne) bunky

578 ArrOfRQSkuCELL(SKUtoBeSetUpQuant) = RQSkuCELL

579 ReDim Preserve ArrOfRQSku(SKUtoBeSetUpQuant)

580 ArrOfRQSku(SKUtoBeSetUpQuant) = SKUtoBeSetUp

581 increment = increment + 1

582 cellTEXT = "=If(iserror(vlookup(" & RQSkuCELL & "," & uv & "[" & Qfile & "]" & PLtab & uv & "!$" &

SKUColLetter & ":$" & SKUColLetter & ", 1, False)), 0, 1)"

583 ActiveCell.Offset(0, 1).Value = cellTEXT

584 ReDim Preserve ArrOfPLind(SKUtoBeSetUpQuant)

585 If ActiveCell.Offset(0, 1).Value = 1 Then

586 ArrOfPLind(SKUtoBeSetUpQuant) = True

587 Else

588 ArrOfPLind(SKUtoBeSetUpQuant) = False

589 End If

590 SKUtoBeSetUpQuant = SKUtoBeSetUpQuant + 1

591 incstring = increment

592 RQSkuCELL = "A" & incstring

593 'If Err.Number = 0 Then

594 'MsgBox "The SKU has been found on the current Fry's PL"

595 'Else

596 'MsgBox "The SKU is not on the current Fry's PL"

597 ' (jinak pro vsechny ostatni chyby by mohl zobrazit tento MsgBox)

598 'End If

599 ActiveCell.Offset(1, 0).Select

600 SKUtoBeSetUp = ActiveCell.FormulaR1C1

601 Loop

602 '***** End of refreshing *********************************************************

603 '*********************************************************************************

604 '***** Records refreshing in line With the inputted SKUs *************************

605 '***** Printing headers **********************************************************

606 For i = 1 To ColQuant Step 1

607 Range("A15").Select

608 ActiveCell.Offset(0, i - 1).Value = ArrHeaders(i - 1)

609 Next i

610 '*********************************************************************************

611 '***** Clearing cells ************************************************************

612 Sheets(C_myMacroSheet).Range("A16:AC26").Select

613 Selection.ClearContents

614 '***** Loading SKUtoBeSetup one by one: Do While SKUtoBeSetUp <> Empty ***********

615 Range("A2").Select

616 SKUtoBeSetUp = ActiveCell.FormulaR1C1

617 SkuColRange1 = SKUColLetter & "2" 'zajistime filtrovani az od druheho radku SKU sloupce

618 w = 0

619 y = 0

620 notSetUpQuant = 0

621 'rowVirtual = 1

622 Do While SKUtoBeSetUp <> Empty 'nacita z input array dokud nenarazi na Empty cell

623 Workbooks(filePL).Sheets(PLtab).Activate

624 Range(SkuColRange1).Select 'vybere napriklad bunku F2

625 SKU = ActiveCell.FormulaR1C1

626

627 Do While (SKU <> SKUtoBeSetUp) And (SKU <> Empty)

628 ActiveCell.Offset(1, 0).Select

629 SKU = ActiveCell.FormulaR1C1

630 Loop

631

632 'pokud nalezne tak vyfiltruje cely radek z PL do makro workbooku

633 'ale ne pomoci copy paste, nybrz jako odkaz z workbooku na PL,

634 'tim ze vlozi nejaky dynamicky utvareny string zacinajici rovnitkem

635 If SKU = SKUtoBeSetUp Then

636 R = ActiveCell.Row

637 'nebudeme kopirovat cely aktivni radek najednou z PL do workbooku

638 'Range(R & ":" & R).Copy

639 'ale zaplnime workbook postupne odkazy na PL bunky

640 Windows(C_myMacroFile).Activate

641 w = w + 1

642 Sheets(C_myMacroSheet).Range("A15").Select

643 ActiveCell.Offset(w, 0).Select

644 myCellAdd = ArrOfRQSkuCELL(w - 1)

645 For pozice = 1 To ColQuant Step 1

646 ColNo = ActiveCell.Column

647 Header = ArrHeaders(pozice - 1)

648 If InStr(1, Header, "Date") <> 0 Then 'jestlize je "Date" v headeru pak Format bude datum

649 Selection.NumberFormat = "mm/dd/yy"

650 ElseIf InStr(1, Header, C_UPC) <> 0 Then

651 Selection.NumberFormat = "0"

652 Else

653 Selection.NumberFormat = "GENERAL" 'need to be Formated as general (not specified), otherwise

Formulae End up as text

654 End If

655 If pozice < 27 Then

656 ColLetter = Mid(ActiveCell.Address, 2, 1)

657 'pro pripad $F$1 a nize budeme operovat s promennou SKUColLetter, tj pismeno sloupce

658 Else

659 ColLetter = Mid(ActiveCell.Address, 2, 2) 'teoreticky pro $AA$1

660 End If

661 If ColNo >= ColNoSku Then

662 If ColNo = ColNoSku Then

663 SKUColLetter = ColLetter

664 End If

665 'myCellAdd = SKUColLetter & "$" & R

666 vlookupPAR3 = ColNo - ColNoSku + 1

667 cellTEXT = "=vlookup(" & myCellAdd & "," & uv & "[" & Qfile & "]" & PLtab & uv & "!" &

SKUColLetter & ":" & ColLetter & "," & vlookupPAR3 & ",0)"

668 ActiveCell.Value = cellTEXT

669 Else

670 Duv = Chr$(34)

671 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))))"

672 ActiveCell.Value = cellTEXT

673 End If

674 ActiveCell.Offset(0, 1).Select

675 Next pozice

676 Range("A2").Select

677 y = y + 1

678 ActiveCell.Offset(y, 0).Select

679 SKUtoBeSetUp = ActiveCell.FormulaR1C1

680 Else

681 Windows(C_myMacroFile).Activate

682 Range("A2").Select

683 y = y + 1

684 ActiveCell.Offset(y, 0).Select

685 SKUtoBeSetUp = ActiveCell.FormulaR1C1

686 w = w + 1 '!!!

687 notSetUpQuant = notSetUpQuant + 1

688 End If

689 Loop

690 '***** loading cells that might be used into a matrix a zkouska tisku **************

691 SetUpQuant = SKUtoBeSetUpQuant - notSetUpQuant

692 SetUpRowFltrd = 0

693 Windows(C_myMacroFile).Activate

694 Sheets(C_myMacroSheet).Select

695 Range("a15").Select

696 ReDim MatrixPLfltrd(SetUpQuant, ColQuant - 1) 'napr 0 az SetUpQuant, 0 az 28 = 29 sloupcu

697 For i = 0 To w

698 If ActiveCell <> Empty Then

699 For j = 0 To ColQuant - 1

700 MatrixPLfltrd(SetUpRowFltrd, j) = ActiveCell.Value '!!! value!!!

701 'vezme vyslednou hodnotu vzorce a ne vzorec v dane bunce a ulozi hodnotu do

702 'MatrixPLfltrd, to je rozdil od ActiveCell.Formula[R1C1]

703 ActiveCell.Offset(0, 1).Select

704 Next j

705 SetUpRowFltrd = SetUpRowFltrd + 1

706 ActiveCell.Offset(1, -ColQuant).Select

707 Else

708 ActiveCell.Offset(1, 0).Select

709 End If

710 ' Do While ActiveCell = Empty 'preskoci prazdne bunky

711 ' ActiveCell.Offset(1, 0).Select

712 ' Loop

713 Next i

714 'from now on we shall only print the matrix just to test values and Formates

715 Range("a29").Select

716 For i = 1 To SetUpQuant 'tisk bez zahlavi -> od 1 ne od 0

717 For j = 0 To ColQuant - 1

718 Select Case MatrixPLfltrd(0, j)

719 Case C_MSD

720 Selection.NumberFormat = "mm/dd/yy"

721 Case C_DateDiscontinued

722 Selection.NumberFormat = "mm/dd/yy"

723 Case C_StartEffectiveDate

724 Selection.NumberFormat = "mm/dd/yy"

725 Case C_EndEffectiveDate

726 Selection.NumberFormat = "mm/dd/yy"

727 Case C_UPC

728 Selection.NumberFormat = "0"

729 Case C_MPQ

730 Selection.NumberFormat = "0"

731 Case C_PalletQuantity

732 Selection.NumberFormat = "0"

733 Case C_NetPrice

734 Selection.NumberFormat = "0.00"

735 Case C_MSRP

736 Selection.NumberFormat = "0.00"

737 Case C_Un_Weight

738 Selection.NumberFormat = "0.00"

739 Case C_Un_Length

740 Selection.NumberFormat = "0.00"

741 Case C_Un_Width

742 Selection.NumberFormat = "0.00"

743 Case C_Un_Depth

744 Selection.NumberFormat = "0.00"

745 Case C_MP_Weight

746 Selection.NumberFormat = "0.00"

747 Case C_MP_Length

748 Selection.NumberFormat = "0.00"

749 Case C_MP_Width

750 Selection.NumberFormat = "0.00"

751 Case C_MP_Depth

752 Selection.NumberFormat = "0.00"

753 Case Else

754 Selection.NumberFormat = "GENERAL"

755 End Select

756 ActiveCell.Value = MatrixPLfltrd(i, j)

757 ActiveCell.Offset(0, 1).Select

758 Next j

759 ActiveCell.Offset(1, -ColQuant).Select

760 Next i

761 'Workbooks(filePL).Close False - pokud zavru PL tak indirect bude ukazovat ihned REF

762 '***********************************************************************************

763 'OPEN MARKETING & TECHNICAL DATA SHEET *********************************************

764 '***********************************************************************************

765 On Error GoTo Chyby

766 'vyhledame z marketingove databaze jen ta SKU, ktera jsou na PL

767 Workbooks.Open Filename:=plocha & "\" & C_myMarketData, ReadOnly:=True

768 Workbooks(C_myMarketData).Sheets("Sheet1").Activate '!!! nutno aktivovat spravny tab !!!

769 Range("A1").Select

770 MarketDataHeader = ActiveCell.FormulaR1C1

771 MarketDataColQuant = 0

772 Do While MarketDataHeader <> Empty

773 MarketDataColQuant = MarketDataColQuant + 1

774 ReDim Preserve ArrMarketDataHeaders(MarketDataColQuant - 1)

775 ArrMarketDataHeaders(MarketDataColQuant - 1) = MarketDataHeader

776 ActiveCell.Offset(0, 1).Select

777 MarketDataHeader = ActiveCell.FormulaR1C1

778 Loop

779 ReDim MarketingMatrix(SetUpQuant - 1, MarketDataColQuant - 1)

780 For i = 1 To SetUpQuant

781 current_SKU = MatrixPLfltrd(i, ColNoSku - 1)

782 k = 0

783 Do While ArrMarketDataHeaders(k) <> C_PartNumber

784 k = k + 1

785 Loop

786 If ArrMarketDataHeaders(k) = C_PartNumber Then

787 SKUColLetter = GetXLCol(ByVal k)

788 End If

789 Range(SKUColLetter & "1").Activate

790 'ted vyhledame to current_SKU jestli v te databazi je (melo by byt, kdyz je na PL),

791 'a jestli vsechny atributy jsou vyplnene to nebudeme zjistovat - databazi je nutno

792 'aktualizovat kazdych 14 dni - Pokud databaze nebude aktualni (SKU nenalezeno), pak

793 'cyklus pobezi do posledniho radku Excelu a nastane chyba -> makro se ukonci, coz je

794 'dobre, aby nesetupoval pak v kategoriich nesmysly !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

795 'Muzem vypsat hlaseni, ze databaze atributu neni aktualni. !!!!!!!!!!!!!!!!!!dodelat

796 done = False

797 Do While current_SKU <> ActiveCell.FormulaR1C1 And done = False

798 ActiveCell.Offset(1, 0).Select

799 If current_SKU = ActiveCell.FormulaR1C1 Then

800 R = ActiveCell.Row

801 Range("A" & R).Activate

802 For jj = 0 To MarketDataColQuant - 1

803 MarketingMatrix(i - 1, jj) = ActiveCell.Offset(0, jj).Value

804 Next jj

805 done = True

806 End If

807 Loop

808 Next i

809 Application.DisplayAlerts = False

810 Application.Workbooks(C_myMarketData).Close SaveChanges:=False

811 '*********************************************************************************

812 '*********************** CYKLUS - SKU SETUP **************************************

813 '*********************************************************************************

814 '*** pro vsechna SKU -> i = 1 To SetUpQuant **************************************

815 done_1 = False 'kontrolni bajt, ze minimalne 1 SKU bylo nasetupovano

816 done_2 = False 'kontrolni bajt rika, ze alespon 1 SKU bylo submitovano

817 done_3 = False 'kontrolni bajt rika, ze jsme se presvedcili o pravdivosti If SetUpQuant <> 0 Then

818 'a ze nenastala chyba On Error GoTo nelzeulozit

819 Set IE = Nothing

820 On Error GoTo nelzeulozit

821 If SetUpQuant <> 0 Then

822 For i = 1 To SetUpQuant 'nebereme v uvahu prvni radek MatrixPLfltrd - zahlavi; vyuzijeme pro prehlednost

ArrHeaders

823 'If ArrOfPLind(i - 1) = True Then

824 If IE Is Nothing Then

825 Set IE = CreateObject("InternetExplorer.Application")

826 With IE

827 .Left = 50

828 .Top = 50

829 .Height = 800

830 .Width = 1000

831 .MenuBar = 0

832 .Toolbar = 1

833 .StatusBar = 0

834 .navigate C_PIMPORTAL_LOGIN

835 'wait a while until IE has finished to load

836 Call is_busy(IE)

837 'OR eq:

838 'Do While IE.busy And Not IE.readystate = 4 : DoEvents : Loop

839 .Visible = 1

840 End With

841 'login - enter ID, pass and click OK

842 With IE.Document

843 .getElementById(C_element_userID).Value = C_myID

844 .getElementById(C_element_password).Value = C_myPW

845 .getElementById(C_element_PC_7_0_64__login).Click

846 End With

847 Call is_busy(IE)

848 End If

849 Do While IE.Busy And Not IE.ReadyState = 4: DoEvents: Loop

850 'click on Item induction

851 'RUN the JAVASCRIPT Function from Within VBA (Function PC_7_0_IS_openURL in the HTML)

852 IE.Document.all.Item

853 Call IE.Document.parentWindow.execScript("javascript:PC_7_0_IS_openURL('Item Induction')",

"JavaScript")

854 Call is_busy(IE)

855 'Excell VBA Calls the Javascript Function openItemNew

856 'Complete Non Data Pool Item - should be New - an mistake in HTML - does not effect anything

857 IE.Document.all.Item

858 Call IE.Document.parentWindow.execScript("javascript:openItemNew('Complete Non Data Pool Item')",

"JavaScript")

859 Call is_busy(IE)

860 'Wait and fill in the Form

861 '******** SELECT CATEGORY AND GENERAL TAB *******************************

862 IE.Document.all.Item("PC_7_0_J3_Category").Click: Call is_busy(IE)

863

864 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"

865

866 Set pop_up = GetOpenIEByURL(pop_up_URL) 'funkce v deklaracni casti vraci

867 ' objekt ze sbirky oken shellu

868

869 '* V matici musim zjistit cisla sloupcu tech poli podle kterych budu zarazovat do kategorii

870

871 'v kazdem pripade je mandatorni ColNoItemName a ColNoBusUnit,

872 'v pripade ColNoDivName, ColNoProType, ColNoLegalName je potreba tyto

873 'promenne take inicializovat, protoze nebudou soucasti pole Headeru

874 'ArrHeaders na Xbox ceniku, jinak by byla chyba pri testovani.

875 'I kdyz nebudeme napr. ColNoDivName potrebovat pri otevrenem Xbox ceniku,

876 'musime nastavit tuto promennou napr. na 1 a bude pak odkazovat na

877 'PriceListName = "UNITED STATES BEST BUY USD FPP" sloupec, takze vysledek

878 'jakehokoliv testovani na nejaky substring bude stejne 0.

879 ColNoDivName = 1

880 ColNoProType = 1

881 ColNoLegalName = 1

882

883 For j = 0 To (ColQuant - 1)

884 Select Case ArrHeaders(j)

885 Case C_ItemName

886 ColNoItemName = j + 1

887 Case C_LegalName

888 ColNoLegalName = j + 1

889 Case C_BusUnit

890 ColNoBusUnit = j + 1

891 Case C_DivName

892 ColNoDivName = j + 1

893 Case C_ProType

894 ColNoProType = j + 1

895 End Select

896 Next j

897

898 '* determinace kategorie na bazi ItemName, BusUnit, DivName, ProType

899 'Predpoklad, ze kategorie je PC_SW_non_VG

900 kategorie = "PC_SW_non-VG"

901

902 If InStr(1, UCase(MatrixPLfltrd(i, ColNoItemName - 1)), "ZUNE") <> 0 Then

903 kategorie = "Zune"

904 If InStr(1, UCase(MatrixPLfltrd(i, ColNoBusUnit - 1)), "ACCESSORIES") <> 0 Then

905 kategorie = "Zune_Accessories" 'sluzi jen k upresneni buyera

906 End If

907 End If

908

909 If InStr(1, UCase(MatrixPLfltrd(i, ColNoItemName - 1)), "XBOX") <> 0 Then

910 kategorie = "Accessories"

911 If InStr(1, UCase(MatrixPLfltrd(i, ColNoBusUnit - 1)), "CONSOLE") <> 0 Then

912 kategorie = "XBOX_Console"

913 End If

914 If InStr(1, UCase(MatrixPLfltrd(i, ColNoBusUnit - 1)), "PARTY") <> 0 Then

915 kategorie = "XBOX_SW"

916 End If

917 If InStr(1, UCase(MatrixPLfltrd(i, ColNoBusUnit - 1)), "XNA 360") <> 0 Then

918 kategorie = "XBOX_SW"

919 End If

920 If InStr(1, UCase(MatrixPLfltrd(i, ColNoBusUnit - 1)), "LIVE") <> 0 Then

921 kategorie = "Accessories"

922 End If

923 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

924 kategorie = "Input_Devices-Game_Controller"

925 End If

926 End If

927

928 If InStr(1, UCase(MatrixPLfltrd(i, ColNoBusUnit - 1)), "WINDOWS GAMING") <> 0 Then

929 kategorie = "VG_PC_SW"

930 End If

931

932 If InStr(1, UCase(MatrixPLfltrd(i, ColNoDivName - 1)), "SDA HARDWARE") <> 0 Then

933 'kategorie = "PC_Hardware"

934 If InStr(1, UCase(MatrixPLfltrd(i, ColNoBusUnit - 1)), "MOUSE") <> 0 Then

935 kategorie = "Input_Devices-Mice"

936 End If

937 If InStr(1, UCase(MatrixPLfltrd(i, ColNoBusUnit - 1)), "KEYBOARD") <> 0 Then

938 kategorie = "Input_Devices-Keyboards"

939 End If

940 If InStr(1, UCase(MatrixPLfltrd(i, ColNoBusUnit - 1)), "ICE") <> 0 Then

941 kategorie = "Web Cams"

942 End If

943 If InStr(1, UCase(MatrixPLfltrd(i, ColNoLegalName - 1)), "MOUSE") <> 0 Then

944 kategorie = "Input_Devices-Mice"

945 If InStr(1, UCase(MatrixPLfltrd(i, ColNoLegalName - 1)), "NOTEBOOK") <> 0 Then

946 kategorie = "Input_Devices-Notebook_Mice" 'kategorie slouzi jen k upresneni buyera

947 End If

948 End If

949 If InStr(1, UCase(MatrixPLfltrd(i, ColNoLegalName - 1)), "KEYBOARD") <> 0 Then

950 kategorie = "Input_Devices-Keyboards"

951 End If

952 End If

953

954 Select Case kategorie

955 Case "Input_Devices-Game_Controller"

956 super_html_kategorie = " Computer and Video Game Control and Input Devices"

957 html_kategorie = " Game Controllers"

958 Case "Input_Devices-Keyboards"

959 super_html_kategorie = " Computer and Video Game Control and Input Devices"

960 html_kategorie = " Keyboards"

961 Case "Input_Devices-Mice"

962 super_html_kategorie = " Computer and Video Game Control and Input Devices"

963 html_kategorie = " Mice and Trackballs"

964 Case "Input_Devices-Notebook_Mice"

965 super_html_kategorie = " Computer and Video Game Control and Input Devices"

966 html_kategorie = " Mice and Trackballs"

967 Case "Accessories"

968 super_html_kategorie = " Computer and Video Game Peripherals"

969 html_kategorie = " Video Game Accessory"

970 Case "Web Cams"

971 super_html_kategorie = " Computer and Video Game Peripherals"

972 html_kategorie = " Web Cameras"

973 Case "PC_SW_non-VG"

974 super_html_kategorie = " Computer and Video Game Software"

975 html_kategorie = " Software Non-Games"

976 Case "VG_PC_SW"

977 super_html_kategorie = " Computer and Video Game Software"

978 html_kategorie = " Video Game Computer Software"

979 Case "XBOX_SW"

980 super_html_kategorie = " Computer and Video Game Software"

981 html_kategorie = " Video Game Software"

982 Case "XBOX_Console"

983 super_html_kategorie = " Video Game Consoles"

984 html_kategorie = " Video Game Hardware - Non Portable"

985 Case "Zune"

986 super_html_kategorie = " Video Game Consoles"

987 html_kategorie = " Video Game Hardware - Portable"

988 Case "Zune_Accessories"

989 super_html_kategorie = " Video Game Consoles"

990 html_kategorie = " Video Game Hardware - Portable"

991 End Select

992

993 j = 0

994 'Call is_busy(pop_up)

995 pop_up.Document.getElementsByTagName("Form")(0).getElementsByTagName("a")(2).Click

996 Call is_busy(pop_up)

997 pop_up.Document.getElementsByTagName("Form")(0).getElementsByTagName("a")(4).Click

998 Call is_busy(pop_up)

999 pop_up.Document.getElementsByTagName("Form")(0).getElementsByTagName("a")(2).Click

1000 Call is_busy(pop_up)

1001 Do While pop_up.Document.all.tags("a")(j).innerTEXT <> super_html_kategorie

1002 j = j + 1

1003 Loop

1004 pop_up.Document.getElementsByTagName("Form")(0).getElementsByTagName("a")(j - 1).Click

1005 Call is_busy(pop_up)

1006 jj = 0

1007 Do While pop_up.Document.all.tags("a")(jj).innerTEXT <> html_kategorie

1008 jj = jj + 1

1009 Loop

1010 pop_up.Document.getElementsByTagName("Form")(0).getElementsByTagName("a")(jj).Click

1011 Call is_busy(pop_up)

1012 pop_up.Document.getElementsByTagName("Form")(0).getElementsByTagName("a")(j - 1).Click

1013 '*** EXIT POP-UP With saving: ****

1014 Call is_busy(pop_up)

1015 'pop_up.Document.all.Item("600000017///800000079").Click 'item name differs depending on how the

category tree is expanded

1016 pop_up.Document.getElementsByTagName("Form")(0).getElementsByTagName("input")(9).Click

1017 Call is_busy(IE)

1018 Set pop_up = Nothing

1019 'Call pop_up.Document.Window.execScript("treenode_onclick('PC_7_0_LU_itemForm')", "JavaScript")

1020 '*** EXIT POP-UP Without saving: ****

1021 'pop_up.Document.all.Item("cancel").Click

1022

1023 'the following was the Former Select Case kategorie logical structure, later replaced by

1024 'the above block where j, jj indices are calculated For a current html_kategorie variable

1025

1026 'elementy jsou indexovany od nuly, TAG A nas zajima, EXPAND NODE

1027 'Select Case kategorie

1028 '[1.]

1029 '/Computer and Video Game Control and Input Devices/Game Controllers

1030 '/Computer and Video Game Control and Input Devices/Keyboards

1031 '/Computer and Video Game Control and Input Devices/Mice and Trackballs

1032 '[2.]

1033 '/Computer and Video Game Peripherals/Video Game Accessory"

1034 '/Computer and Video Game Peripherals/Web Cameras"

1035 '[3.]

1036 '/Computer and Video Game Software/Software Non-Games"

1037 '/Computer and Video Game Software/Video Game Computer Software"

1038 '/Computer and Video Game Software/Video Game Software"

1039 'EXAMPLE *** expand computer and video game SW ***

1040 ' Case "PC_SW_non-VG"

1041 ' pop_up.Document.getElementsByTagName("Form")(0).getElementsByTagName("a")(j - 1).Click

1042 ' Call is_busy(pop_up)

1043 ' jj = 0

1044 ' Do While pop_up.Document.all.tags("a")(jj).innerTEXT <> html_kategorie

1045 ' jj = jj + 1

1046 ' Loop

1047 ' pop_up.Document.getElementsByTagName("Form")(0).getElementsByTagName("a")(jj).Click

1048 ' Call is_busy(pop_up)

1049 '*** collapse:

1050 ' pop_up.Document.getElementsByTagName("Form")(0).getElementsByTagName("a")(j - 1).Click

1051 '[4.] - We shall not use this group - too many info required - We shall include Zune under [5]

1052 '/Portable Audio and Video/Portable MP3"

1053 '/Portable Audio and Video/Portable DVD Players"

1054 '/Portable Audio and Video/Video Accessory"

1055 'pop_up.Document.getElementsByTagName("Form")(0).getElementsByTagName("a")(70).Click

1056 '[5.]

1057 '/Video Game Consoles/Video Game Hardware - Non Portable" - napr XBOX Console

1058 '/Video Game Consoles/Video Game Hardware - Portable"

1059 'End Select

1060

1061 With IE.Document

1062

1063 For j = 0 To ColQuant - 1

1064 Select Case ArrHeaders(j)

1065 Case C_ItemName

1066 'Best Buy Description

1067 .getElementById("_215127057_0_1352413751_0_1366209486_0").Value = MatrixPLfltrd(i, j)

1068 'Description sign

1069 .getElementById("_215127057_0_1352413751_0_334658439_0").Value = MatrixPLfltrd(i, j)

1070 Case C_PartNumber

1071 'Model or Selection

1072 .getElementById("_215127057_0_1742083922_0_233841037_0").Value = MatrixPLfltrd(i, j)

1073 current_SKU = MatrixPLfltrd(i, j)

1074 ReDim Preserve get_arr_of_set_up_SKU(i - 1)

1075 get_arr_of_set_up_SKU(i - 1) = current_SKU

1076 'Item comments

1077 .getElementById("_215127057_0_426000597_0_1141097592_0").Value = "New Item Setup For " &

MatrixPLfltrd(i, j)

1078 Case C_UPC

1079 'UPC type

1080 .all.Item("_215127057_0_1742083922_0_27072232_0_2126757239_0").selectedIndex = 3

1081 'UPC

1082 .getElementById("_215127057_0_1742083922_0_27072232_0_768654447_0").Value =

MatrixPLfltrd(i, j)

1083 ReDim Preserve get_arr_of_UPC(i - 1)

1084 get_arr_of_UPC(i - 1) = MatrixPLfltrd(i, j)

1085 Case C_MSRP

1086 'Suggested retail

1087 .getElementById("_215127057_0_249243837_0_2086194608_0_1833282399_0").Value =

MatrixPLfltrd(i, j)

1088 Case Else

1089 End Select

1090 Next j

1091

1092 ' Send notification to ************************

1093 ' PC Games Ed Hewitt (Dawn Vierow is on mat. Leave)

1094 ' PC SW (non-game) Huan Nguyen

1095 ' PC HW (Keyboards, LifeCams,LifeChat, non-Notebook Mice) - Kristi Baso

1096 ' PC HW (Notebook Mice) - Katie Penza

1097 ' Xbox SW - Jenna Susko

1098 ' Xbox HW & Accessories - David Arndt

1099 ' Zune HW - Tom Kluis

1100 ' Zune Accessories - Charles Murray

1101 Select Case kategorie

1102 Case "Input_Devices-Game_Controller"

1103 .getElementById("_215127057_0_426000597_0_351613033_0").Value = "Kristi Baso"

1104 Case "Input_Devices-Keyboards"

1105 .getElementById("_215127057_0_426000597_0_351613033_0").Value = "Kristi Baso"

1106 Case "Input_Devices-Mice"

1107 .getElementById("_215127057_0_426000597_0_351613033_0").Value = "Kristi Baso"

1108 Case "Web Cams"

1109 .getElementById("_215127057_0_426000597_0_351613033_0").Value = "Kristi Baso"

1110 Case "Input_Devices-Notebook_Mice"

1111 .getElementById("_215127057_0_426000597_0_351613033_0").Value = "Katie Penza"

1112 Case "Accessories"

1113 .getElementById("_215127057_0_426000597_0_351613033_0").Value = "David Arndt"

1114 Case "XBOX_Console"

1115 .getElementById("_215127057_0_426000597_0_351613033_0").Value = "David Arndt"

1116 Case "PC_SW_non-VG"

1117 .getElementById("_215127057_0_426000597_0_351613033_0").Value = "Huan Nguyen"

1118 Case "VG_PC_SW"

1119 .getElementById("_215127057_0_426000597_0_351613033_0").Value = "Ed Hewitt"

1120 Case "XBOX_SW"

1121 .getElementById("_215127057_0_426000597_0_351613033_0").Value = "Jenna Susko"

1122 Case "Zune"

1123 .getElementById("_215127057_0_426000597_0_351613033_0").Value = "Tom Kluis"

1124 Case "Zune_Accessories"

1125 .getElementById("_215127057_0_426000597_0_351613033_0").Value = "Charles Murray"

1126 End Select

1127

1128 ' Warranty decision block ***********************

1129 ' Warranty indicator

1130 .getElementById("_215127057_0_263500921_0_318388927_0").selectedIndex = 2

1131

1132 If InStr(1, kategorie, "SW") <> 0 Then

1133 ' Warranty Labour Days/Years

1134 .getElementById("_215127057_0_263500921_0_1935191691_0").Value = 90 'days

1135 ' Warranty Parts Days/Years

1136 .getElementById("_215127057_0_263500921_0_434903867_0").Value = 90 'days

1137 Else

1138 .getElementById("_215127057_0_263500921_0_158089848_0").Value = 3 'years

1139 .getElementById("_215127057_0_263500921_0_577627864_0").Value = 3 'years

1140 End If

1141 '** Sample Sent

1142 .all.Item("_215127057_0_224502806_0_1599375785_0").selectedIndex = 1

1143 '******* SAVE GENERAL **********************

1144 .all.Item("PC_7_0_J3_SAVE").Click: Call is_busy(IE)

1145 '********* SUPPLIER TAB *************************************************

1146 .getElementById("tab2").Click: Call is_busy(IE)

1147 '** determining MSFT Xbox or Microsoft algorithm (from the file name)

1148 If InStr(1, C_myMacroFile, "XBox") <> 0 Then

1149 .all.Item("_1552681051_0_1865545603_0_326364010_0").Value = "Microsoft Xbox Corporation"

1150 Else

1151 .all.Item("_1552681051_0_1865545603_0_326364010_0").Value = "Microsoft"

1152 End If

1153 'Private Label Indicator = No

1154 .all.Item("_1552681051_0_2143843476_0_198836717_0").selectedIndex = 1

1155 'Primary Origin Country Indicator = Yes --- BY DEFAULT

1156 'IE.document.all.Item("_1552681051_0_1053610938_0_259351390_0").selectedIndex = 2

1157 'Country of Origin for BBY Purchase = United States --- BY DEFAULT

1158 'IE.document.all.Item("_1552681051_0_1053610938_0_190972293_0").value = United States

1159 For j = 0 To ColQuant - 1

1160 If ArrHeaders(j) = C_NetPrice Then

1161 'Unit Cost

1162 .getElementById("_1552681051_0_1053610938_0_1408138848_0_1499822074_0").Value =

MatrixPLfltrd(i, j)

1163 End If

1164 Next j

1165 '******* SAVE SUPPLIER TAB ****************

1166 .all.Item("PC_7_0_J3_SAVE").Click: Call is_busy(IE)

1167 '********* LOGISTICS TAB *************************************************

1168 .getElementById("tab3").Click: Call is_busy(IE)

1169 '** Unit Dimensions and Weight *******************

1170 'a. Length or Depth = MS Unit Width

1171 'b. Width = MS Unit Depth

1172 'c. Height = MS Unit Length

1173 'd. Dimensions UOM = IN (choose from the drop down)

1174 'e. Weight = MS Unit Weight

1175 'f. Weight UOM = LB (choose from the drop down)

1176

1177 For j = 0 To ColQuant - 1

1178 Select Case ArrHeaders(j)

1179 Case C_Un_Width

1180 For iii = 0 To 2

1181 .getElementById("_1715640154_0_553772606_" & iii & "_1269885005_0").Value =

MatrixPLfltrd(i, j)

1182 Next iii

1183 Case C_Un_Depth

1184 For iii = 0 To 2

1185 .getElementById("_1715640154_0_553772606_" & iii & "_267338521_0").Value =

MatrixPLfltrd(i, j)

1186 Next iii

1187 Case C_Un_Length

1188 For iii = 0 To 2

1189 .getElementById("_1715640154_0_553772606_" & iii & "_735435212_0").Value =

MatrixPLfltrd(i, j)

1190 Next iii

1191 Case C_Un_Weight

1192 For iii = 0 To 2

1193 .getElementById("_1715640154_0_553772606_" & iii & "_305997947_0").Value =

MatrixPLfltrd(i, j)

1194 Next iii

1195 Case Else

1196 End Select

1197 Next j

1198 'UOM - IN or LB For unit and MP

1199 For iii = 0 To 3

1200 .all.Item("_1715640154_0_553772606_" & iii & "_354836947_0").selectedIndex = 3

1201 .all.Item("_1715640154_0_553772606_" & iii & "_434201048_0").selectedIndex = 3

1202 Next iii

1203

1204 '** Master Pak Dimensions and Weight ***********

1205 For j = 0 To ColQuant - 1

1206 Select Case ArrHeaders(j)

1207 Case C_MP_Length

1208 .getElementById("_1715640154_0_553772606_3_1269885005_0").Value = MatrixPLfltrd(i, j)

1209 Case C_MP_Depth

1210 .getElementById("_1715640154_0_553772606_3_267338521_0").Value = MatrixPLfltrd(i, j)

1211 Case C_MP_Width

1212 .getElementById("_1715640154_0_553772606_3_735435212_0").Value = MatrixPLfltrd(i, j)

1213 Case C_MP_Weight

1214 .getElementById("_1715640154_0_553772606_3_305997947_0").Value = MatrixPLfltrd(i, j)

1215 End Select

1216 Next j

1217 '****** Inner, MPQ, TI, HI, IND ****************************

1218 'Inner Pack - Number of Eaches = Always 1

1219 .getElementById("_1715640154_0_662665405_0_1898596981_0").Value = 1

1220

1221 For j = 0 To ColQuant - 1

1222 'Case Pack - Number of Eaches = Masterpack Qty

1223 If ArrHeaders(j) = C_MPQ Then

1224 .getElementById("_1715640154_0_662665405_0_1429791177_0").Value = MatrixPLfltrd(i, j)

1225 End If

1226 'Pallet - Number of Eaches

1227 If ArrHeaders(j) = C_PalletQuantity Then

1228 .getElementById("_1715640154_0_662665405_0_400926649_0").Value = MatrixPLfltrd(i, j)

1229 End If

1230 Next j

1231

1232 Call pvtus_SQL_dotaz(TI, HI, current_SKU)

1233

1234 .getElementById("_1715640154_0_662665405_0_1795435815_0").Value = TI

1235 .getElementById("_1715640154_0_662665405_0_1163388972_0").Value = HI

1236

1237 'One Way Ind = NO --- BY DEFAULT in HTML

1238

1239 'BBY Direct Import Ind = No

1240 .all.Item("_1715640154_0_81096678_0_552511319_0").selectedIndex = 1

1241 '******* SAVE Logistics Tab ***************

1242 .all.Item("PC_7_0_J3_SAVE").Click: Call is_busy(IE)

1243 '********* DATES TAB *************************************************

1244 .getElementById("tab4").Click: Call is_busy(IE)

1245 'the VBA code cannot see the ID in HTML, so we will use getElementsByTagName("input")

1246 'the indexed order of the input element is 108, starting from 0

1247 slashQ = 0

1248 MM = ""

1249 DD = ""

1250 YY = ""

1251 MyTime = Format(Time, "hh:mm:ss") ' nechceme Format(Time, "hh:mm:ss AMPM")

1252 'MyTime = Mid(MyTime, 1, 8) v pripade, ze by to bylo deklarovano: Dim MyTime As Date, pak

1253 'implicitne pridava AM/PM nezavisle na Formatu, proto je to Dimenzovano MyTime As String

1254 For j = 0 To ColQuant - 1

1255 If ArrHeaders(j) = C_MSD Then

1256 If Len(MatrixPLfltrd(i, j)) <> 0 Then

1257 For iii = 1 To Len(MatrixPLfltrd(i, j))

1258 If Mid(MatrixPLfltrd(i, j), iii, 1) <> "/" And slashQ = 0 Then

1259 MM = MM + Mid(MatrixPLfltrd(i, j), iii, 1)

1260 End If

1261 If Mid(MatrixPLfltrd(i, j), iii, 1) <> "/" And slashQ = 1 Then

1262 DD = DD + Mid(MatrixPLfltrd(i, j), iii, 1)

1263 End If

1264 If Mid(MatrixPLfltrd(i, j), iii, 1) <> "/" And slashQ = 2 Then

1265 YY = YY + Mid(MatrixPLfltrd(i, j), iii, 1)

1266 End If

1267 If Mid(MatrixPLfltrd(i, j), iii, 1) = "/" Then

1268 slashQ = slashQ + 1

1269 End If

1270 Next iii

1271 If Len(MM) = 1 Then

1272 MM = "0" + MM

1273 End If

1274 If Len(DD) = 1 Then

1275 DD = "0" + DD

1276 End If

1277 .getElementsByTagName("Form")(0).getElementsByTagName("input")(108).Value = YY & "-" & MM &

"-" & DD & " " & MyTime

1278 End If

1279 End If

1280 Next j

1281 BBuy_win = FindWindow(ByVal vbNullString, ByVal "Best Buy PIM Portal - Windows Internet Explorer")

1282 Call SetFocusAPI(ByVal BBuy_win)

1283 For j = 1 To 300

1284 Call PostMessage(ByVal BBuy_win, ByVal WM_KEYDOWN, ByVal VK_TAB, ByVal 0&)

1285 Call PostMessage(ByVal BBuy_win, ByVal WM_KEYUP, ByVal VK_TAB, ByVal 0&)

1286 Sleep 100 'ms

1287 Next j

1288 '******* SAVE Dates Tab *******************

1289 .all.Item("PC_7_0_J3_SAVE").Click: Call is_busy(IE)

1290 '********* Category TAB *************************************************

1291 .getElementById("tab5").Click: Call is_busy(IE)

1292 'Hodnoty atributu kategorii jsou ulozeny v MarketingMatrix - bez headeru

1293 'muzeme projit pole ArrMarketDataHeaders a najit header a jeho pozici - index

1294 'pak se pomoci indexu odkazat na odpovidajici index sloupce MarketingMatrix

1295 'k = 0

1296 'Do While ArrMarketDataHeaders(k) <> "Operating system"

1297 ' k = k + 1

1298 'Loop

1299 'IE.document.all.Item("_1562711832_0").selectedIndex = MarketingMatrix(0, k)

1300

1301 'Select Case kategorie

1302 'Case "PC_SW_non-VG"

1303 'Case "VG_PC_SW"

1304 'Case "Zune"

1305 'Case "Accessories" 'XBOX

1306 'Case "XBOX_Console"

1307 'Case "XBOX_SW"

1308 'Case "Input_Devices-Game_Controller"

1309 'Case "Input_Devices-Mice"

1310 'Case "Input_Devices-Keyboards"

1311 'Case "Web Cams"

1312 'End Select

1313

1314 'PREDEM SI STANOVIME INDEXY URCITYCH ATRIBUTU, KTERE SE OPAKUJI, ABY SE KOD ZKRATIL

1315 Dim vista(3) As String

1316 vista(0) = "Bus": vista(1) = "Basic": vista(2) = "Prem": vista(3) = "Ultim"

1317 Dim indx_vista, index_OS As Byte

1318 indx_vista = 0

1319

1320 'DETERMINACE OPERACNIHO SYSTEMU

1321 k = 0

1322 Do While ArrMarketDataHeaders(k) <> "Operating system"

1323 k = k + 1

1324 Loop

1325

1326 Select Case MarketingMatrix(i - 1, k)

1327 Case "" 'Not Applicable

1328 index_OS = 6

1329 Case "Vista" 'jen pripad pro rozrazeni verzi Visty

1330 For j = 7 To 13 Step 2

1331 If InStr(1, MarketingMatrix(i - 1, k), vista(indx_vista)) Then

1332 index_OS = j

1333 If InStr(1, MarketingMatrix(i - 1, k), "64") Then

1334 index_OS = j + 1

1335 End If

1336 End If

1337 indx_vista = indx_vista + 1

1338 Next j

1339 Case Else 'zbytek je kombinace Vista/XP -> uprednostnim XP (nizsi verzi) a na 95, 98 atp.

1340 'neberu v bunce ohled.

1341 If InStr(1, MarketingMatrix(i - 1, k), "XP") Then

1342 index_OS = 16

1343 Else 'jestlize neni XP na vyber, pak volim obecne Windows

1344 index_OS = 15

1345 End If

1346 End Select

1347

1348 Dim CPU_min(16), CPU_rcmd(13) As Integer

1349 Dim index_CPU_min, index_UOM_min, index_CPU_rcm, index_UOM_rcm, index_genre, index_rating As Byte

1350 CPU_min(0) = 0#: CPU_min(1) = 1#: CPU_min(2) = 1.5: CPU_min(3) = 1.8

1351 CPU_min(4) = 1.9: CPU_min(5) = 2#: CPU_min(6) = 2.5: CPU_min(7) = 3#

1352 CPU_min(8) = 300#: CPU_min(9) = 400#: CPU_min(10) = 500#: CPU_min(11) = 600#

1353 CPU_min(12) = 700#: CPU_min(13) = 800#: CPU_min(14) = 900#: CPU_min(15) = 1200#

1354 CPU_min(16) = 1800#

1355

1356 CPU_rcmd(0) = 0#: CPU_rcmd(1) = 1#: CPU_rcmd(2) = 1.5: CPU_rcmd(3) = 2#

1357 CPU_rcmd(4) = 2.5: CPU_rcmd(5) = 3#: CPU_rcmd(6) = 300#: CPU_rcmd(7) = 400#

1358 CPU_rcmd(8) = 500#: CPU_rcmd(9) = 600#: CPU_rcmd(10) = 700#: CPU_rcmd(11) = 800#

1359 CPU_rcmd(12) = 900#: CPU_rcmd(13) = 2500#

1360

1361 'DETERMINACE MINIMALNI FREKVENCE

1362 k = 0

1363 Do While ArrMarketDataHeaders(k) <> "Min Required CPU Speed"

1364 k = k + 1

1365 Loop

1366 For j = 0 To 15

1367 If Val(MarketingMatrix(i - 1, k)) > CPU_min(j) And Val(MarketingMatrix(i - 1, k)) <= CPU_min(j +

1) Then

1368 index_CPU_min = j + 2

1369 End If

1370 Next j

1371 If Val(MarketingMatrix(i - 1, k)) > CPU_min(UBound(CPU_min)) Then

1372 index_CPU_min = UBound(CPU_min) + 1

1373 End If

1374 'DETERMINACE UOM - UNIT OF MEASURE

1375 k = 0

1376 Do While ArrMarketDataHeaders(k) <> "CPU Speed UOM"

1377 k = k + 1

1378 Loop

1379 If MarketingMatrix(i - 1, k) = "GHz" Then

1380 index_UOM_min = 1

1381 Else

1382 index_UOM_min = 2

1383 End If

1384 'DETERMINACE DOPORUCENE FREKVENCE

1385 k = 0

1386 Do While ArrMarketDataHeaders(k) <> "Rcmded CPU Speed"

1387 k = k + 1

1388 Loop

1389 For j = 0 To 12

1390 If Val(MarketingMatrix(i - 1, k)) > CPU_rcmd(j) And Val(MarketingMatrix(i - 1, k)) <= CPU_rcmd(j

+ 1) Then

1391 index_CPU_rcm = j + 2

1392 End If

1393 Next j

1394 If Val(MarketingMatrix(i - 1, k)) > CPU_rcmd(UBound(CPU_rcmd)) Then

1395 index_CPU_rcm = UBound(CPU_rcmd) + 1

1396 End If

1397 'DETERMINACE UOM PRO RCMDED CPU SPEED

1398 k = 0

1399 Do While ArrMarketDataHeaders(k) <> "Rcmded CPU Speed UOM"

1400 k = k + 1

1401 Loop

1402 If MarketingMatrix(i - 1, k) = "GHz" Then

1403 index_UOM_rcm = 1

1404 Else

1405 index_UOM_rcm = 2

1406 End If

1407 'DETERMINACE GENRE

1408 k = 0

1409 Do While ArrMarketDataHeaders(k) <> "Genre"

1410 k = k + 1

1411 Loop

1412 Select Case MarketingMatrix(i - 1, k)

1413 Case "Action": index_genre = 1: Case "Adult": index_genre = 2

1414 Case "Adventure": index_genre = 3: Case "DEVELOPMENT TOOLS": index_genre = 4

1415 Case "Educational": index_genre = 5: Case "Emulators": index_genre = 6

1416 Case "Family Entertainment": index_genre = 7: Case "Fighting": index_genre = 8

1417 Case "Home": index_genre = 9: Case "Music": index_genre = 10

1418 Case "Other": index_genre = 11: Case "Puzzle": index_genre = 12

1419 Case "Racing": index_genre = 13: Case "Reference": index_genre = 14

1420 Case "RPG": index_genre = 15: Case "action RPG": index_genre = 15

1421 Case "tactical action games, shooter": index_genre = 16

1422 Case "shooter": index_genre = 16: Case "Simulation": index_genre = 17

1423 Case "Sports": index_genre = 18: Case "Strategy": index_genre = 19

1424 Case "Real Time Strategy": index_genre = 19: Case "Traditional": index_genre = 20

1425 Case "Utility": index_genre = 21: Case "Variety": index_genre = 22

1426 Case "WRESTLING": index_genre = 23

1427 End Select

1428 'DETERMINACE RATING

1429 k = 0

1430 Do While ArrMarketDataHeaders(k) <> "Rating"

1431 k = k + 1

1432 Loop

1433 Select Case MarketingMatrix(i - 1, k)

1434 Case "AO": index_rating = 1: Case "E": index_rating = 2

1435 Case "Everyone 10+": index_rating = 3: Case "EC": index_rating = 4

1436 Case "Mature M17+": index_rating = 7: Case "NOT_RATED": index_rating = 9

1437 Case "RATING_PENDING": index_rating = 13: Case "Teen": index_rating = 15

1438 Case "UN_RATED": index_rating = 16: Case "X_RATED": index_rating = 17

1439 End Select

1440

1441 Dim index_prim, index_sec As Byte

1442 'DETERMINACE PRIMARY COLOR

1443 k = 0

1444 Do While ArrMarketDataHeaders(k) <> "Primary Color"

1445 k = k + 1

1446 Loop

1447 Select Case MarketingMatrix(i - 1, k)

1448 Case "Assorted": index_prim = 1: Case "Bisque": index_prim = 2

1449 Case "Black": index_prim = 3: Case "Blue": index_prim = 4

1450 Case "Bronze": index_prim = 5: Case "Brown": index_prim = 6

1451 Case "Burgundy": index_prim = 7: Case "Camel": index_prim = 8

1452 Case "Carbon Fiber": index_prim = 9: Case "Champagne": index_prim = 10

1453 Case "Charcoal Grey": index_prim = 11: Case "Cherry": index_prim = 12

1454 Case "Clear": index_prim = 13: Case "Cosmopolitan": index_prim = 14

1455 Case "Cream": index_prim = 15: Case "Cyan": index_prim = 16

1456 Case "Dove": index_prim = 17: Case "Espresso": index_prim = 18

1457 Case "Gold": index_prim = 19: Case "Granite": index_prim = 20

1458 Case "Green": index_prim = 21: Case "Grey": index_prim = 22

1459 Case "Indigo": index_prim = 23: Case "Ivory": index_prim = 24

1460 Case "Khaki": index_prim = 25: Case "Lavender": index_prim = 26

1461 Case "Light Blue": index_prim = 27: Case "Light Green": index_prim = 28

1462 Case "Light Purple": index_prim = 29: Case "Magenta": index_prim = 30

1463 Case "Maple": index_prim = 31: Case "Mossy Oak Camo": index_prim = 32

1464 Case "Natural Silver": index_prim = 33: Case "Navy": index_prim = 34

1465 Case "Not Applicable": index_prim = 35: Case "Oak": index_prim = 36

1466 Case "Off White": index_prim = 37: Case "Olive": index_prim = 38

1467 Case "Orange": index_prim = 39: Case "Piano Black": index_prim = 40

1468 Case "Pink": index_prim = 41: Case "Platinum": index_prim = 42

1469 Case "Purple": index_prim = 43: Case "Red": index_prim = 44

1470 Case "Rose": index_prim = 45: Case "Sangria": index_prim = 46

1471 Case "Sapphire": index_prim = 47: Case "Silver": index_prim = 48

1472 Case "Spice": index_prim = 49: Case "Stainless": index_prim = 50

1473 Case "Titanium": index_prim = 51: Case "White": index_prim = 52

1474 Case "Yellow": index_prim = 53

1475 End Select

1476 'DETERMINACE SECONDARY COLOR

1477 k = 0

1478 Do While ArrMarketDataHeaders(k) <> "Secondary Color"

1479 k = k + 1

1480 Loop

1481 Select Case MarketingMatrix(i - 1, k)

1482 Case "Bisque": index_sec = 1: Case "Black": index_sec = 2

1483 Case "Blue": index_sec = 3: Case "Brown": index_sec = 4

1484 Case "Cherry": index_sec = 5: Case "Clear": index_sec = 6

1485 Case "Cream": index_sec = 7: Case "Cyan": index_sec = 8

1486 Case "Espresso": index_sec = 9: Case "Gold": index_sec = 10

1487 Case "Green": index_sec = 11: Case "Grey": index_sec = 12

1488 Case "Ivory": index_sec = 13: Case "Khaki": index_sec = 14

1489 Case "Light Blue": index_sec = 15: Case "Light Green": index_sec = 16

1490 Case "Light Purple": index_sec = 17: Case "Magenta": index_sec = 18

1491 Case "Maple": index_sec = 19: Case "Mossy Oak Camo": index_sec = 20

1492 Case "Natural Silver": index_sec = 21: Case "Navy": index_sec = 22

1493 Case "Not Applicable": index_sec = 23: Case "Oak": index_sec = 24

1494 Case "Off White": index_sec = 25: Case "Orange": index_sec = 26

1495 Case "Pink": index_sec = 27: Case "Platinum": index_sec = 28

1496 Case "Purple": index_sec = 29: Case "Red": index_sec = 30

1497 Case "Silver": index_sec = 31: Case "Stainless": index_sec = 32

1498 Case "Titanium": index_sec = 33: Case "White": index_sec = 34

1499 Case "Yellow": index_sec = 35

1500 End Select

1501

1502 Dim index_cntrl As Byte

1503 'DETERMINACE TYPU OVLADACE

1504 k = 0

1505 Do While ArrMarketDataHeaders(k) <> "Controller Type"

1506 k = k + 1

1507 Loop

1508 Select Case MarketingMatrix(i - 1, k)

1509 Case "Dance Pad": index_cntrl = 1: Case "Not Applicable": index_cntrl = 2

1510 Case "Remote": index_cntrl = 3: Case "Wheel": index_cntrl = 4

1511 Case "Wired": index_cntrl = 5: Case "Wireless": index_cntrl = 6

1512 End Select

1513

1514 Dim index_peri As Byte

1515 'DETERMINACE TYPU PERIFERNIHO HERNIHO ZARIZENI

1516 k = 0

1517 Do While ArrMarketDataHeaders(k) <> "Gaming Peripheral Type"

1518 k = k + 1

1519 Loop

1520 Select Case MarketingMatrix(i - 1, k)

1521 Case "Bundle": index_peri = 1: Case "Cable": index_peri = 2

1522 Case "Care": index_peri = 3: Case "Case": index_peri = 4

1523 Case "Cheat": index_peri = 5: Case "Control": index_peri = 6

1524 Case "Customization": index_peri = 7: Case "Memory": index_peri = 8

1525 Case "Multimedia": index_peri = 9: Case "Networking": index_peri = 10

1526 Case "Not Applicable": index_peri = 11: Case "Power": index_peri = 12

1527 Case "Sound": index_peri = 13

1528 End Select

1529

1530 Select Case kategorie

1531 '*******************************

1532 Case "PC_SW_non-VG"

1533 '*******************************

1534 'Operating system: Not Applicable, Vista Business, Vista Business 64-Bit, Vista Home Basic,

1535 ' Vista Home Basic 64-Bit, Vista Home Premium, Vista Home Premium 64-Bit,

1536 ' Vista Ultimate, Vista Ultimate 64-Bit, Windows, XP

1537 .all.Item("_1562711832_0").selectedIndex = index_OS

1538 'Minimum Required Processor Speed: 0.0, 1.0, 1.5, 1.8, 1.9, 2.0, 2.5, 3.0, 300.0, 400.0

1539 ' 500.0, 600.0, 700.0, 800.0, 900.0, 1200.0, 1800.0

1540 .all.Item("_181242228_0").selectedIndex = index_CPU_min

1541 'Minimum Required Processor Speed UOM: GHz, MHz

1542 .all.Item("_1834189895_0").selectedIndex = index_UOM_min

1543 'Recommended Processor Speed: 0.0, 1.0, 1.5, 2.0, 2.5, 3.0, 300.0, 400.0, 500.0, 600.0, 700.0,

800.0, 900.0, 2500.0

1544 .all.Item("_1315705878_0").selectedIndex = index_CPU_rcm

1545 'Recommended Processor Speed UOM: GHz, MHz

1546 .all.Item("_1399342147_0").selectedIndex = index_UOM_rcm

1547 '*******************************

1548 Case "VG_PC_SW"

1549 '***************************

1550 'Game PlatForm: XBOX_360, (Xbox was discontinued in late 2006)

1551 .all.Item("_366871758_0").selectedIndex = 13 'always

1552 'Genre: ACTION, ADULT, ADVENTURE, EDUCATIONAL, EMULATORS, FAMILY, ENTERTAINMENT, FIGHTING,

1553 ' MUSIC, HOME, OTHER, PUZZLE, RACING, REFERENCE, ROLE_PLAYING, SHOOTER, SIMULATION,

1554 ' SPORTS, STRATEGY, TRADITIONAL, UTILITY, VARIETY, WRESTLING, DEVELOPMENT TOOLS

1555 .all.Item("_127407284_0").selectedIndex = index_genre

1556 'Rating: AO, E, E10+, EC, G, INHALANT, M, NC_17, NOT_RATED, PG, PG_13, R, RATING_PENDING,

1557 ' RP, T, UN_RATED, X_RATED

1558 .all.Item("_33944436_0").selectedIndex = index_rating

1559 'Street Date:

1560 k = 0

1561 Do While ArrMarketDataHeaders(k) <> "street date"

1562 k = k + 1

1563 Loop

1564 street_date = MarketingMatrix(i - 1, k) 'street date musi byt ve Formatu YYYY-MM-DD hh:mm:ss

1565 If street_date = "" Then 'If not street dated Then fill in MSD

1566 slashQ = 0

1567 MM = ""

1568 DD = ""

1569 YY = ""

1570 MyTime = Format(Time, "hh:mm:ss")

1571 For j = 0 To ColQuant - 1

1572 If ArrHeaders(j) = C_MSD Then

1573 If Len(MatrixPLfltrd(i, j)) <> 0 Then

1574 For iii = 1 To Len(MatrixPLfltrd(i, j))

1575 If Mid(MatrixPLfltrd(i, j), iii, 1) <> "/" And slashQ = 0 Then

1576 MM = MM + Mid(MatrixPLfltrd(i, j), iii, 1)

1577 End If

1578 If Mid(MatrixPLfltrd(i, j), iii, 1) <> "/" And slashQ = 1 Then

1579 DD = DD + Mid(MatrixPLfltrd(i, j), iii, 1)

1580 End If

1581 If Mid(MatrixPLfltrd(i, j), iii, 1) <> "/" And slashQ = 2 Then

1582 YY = YY + Mid(MatrixPLfltrd(i, j), iii, 1)

1583 End If

1584 If Mid(MatrixPLfltrd(i, j), iii, 1) = "/" Then

1585 slashQ = slashQ + 1

1586 End If

1587 Next iii

1588 If Len(MM) = 1 Then

1589 MM = "0" + MM

1590 End If

1591 If Len(DD) = 1 Then

1592 DD = "0" + DD

1593 End If

1594 .getElementsByTagName("Form")(0).getElementsByTagName("input")(116).Value = YY & "-"

& MM & "-" & DD & " " & MyTime

1595 End If

1596 End If

1597 Next j

1598 Else

1599 .getElementsByTagName("Form")(0).getElementsByTagName("input")(116).Value = street_date & " "

& MyTime

1600 End If

1601 BBuy_win = FindWindow(ByVal vbNullString, ByVal "Best Buy PIM Portal - Windows Internet

Explorer")

1602 Call SetFocusAPI(ByVal BBuy_win)

1603 For j = 1 To 300

1604 Call PostMessage(ByVal BBuy_win, ByVal WM_KEYDOWN, ByVal VK_TAB, ByVal 0&)

1605 Call PostMessage(ByVal BBuy_win, ByVal WM_KEYUP, ByVal VK_TAB, ByVal 0&)

1606 Sleep 100 'ms

1607 Next j

1608 'Minimum Required Processor Speed: 0.0, 1.0, 1.5, 1.8, 1.9, 2.0, 2.5, 3.0, 300.0, 400.0

1609 ' 500.0, 600.0, 700.0, 800.0, 900.0, 1200.0, 1800.0

1610 .all.Item("_1395721575_0").selectedIndex = index_CPU_min

1611 'Minimum Required Processor Speed UOM: GHz, MHz

1612 .all.Item("_1631443692_0").selectedIndex = index_UOM_min

1613 'Recommended Processor Speed: 0.0, 1.0, 1.5, 2.0, 2.5, 3.0, 300.0, 400.0, 500.0, 600.0,

1614 ' 700.0, 800.0, 900.0, 2500.0

1615 .all.Item("_1312790437_0").selectedIndex = index_CPU_rcm

1616 'Recommended Processor Speed UOM: GHz, MHz

1617 .all.Item("_1874924024_0").selectedIndex = index_UOM_rcm

1618 'Number of Discs: 1

1619 .getElementById("_876150083_0").Value = 1

1620 '*******************************

1621 Case "Zune"

1622 '*******************************

1623 'CE and Accessory Primary Color

1624 .all.Item("_268021381_0").selectedIndex = index_prim

1625 'CE and Accessory Secondary Color

1626 .all.Item("_951516279_0").selectedIndex = index_sec

1627 '*******************************

1628 Case "Accessories" 'XBOX

1629 '*******************************

1630 'Accessory Ind: None = 0, No = 1, Yes = 2

1631 .all.Item("_1642772424_0").selectedIndex = 2

1632 'Controller Type: None, Dance Pad, Not Applicable, Remote, Wheel, Wired, Wireless

1633 .all.Item("_1690754485_0").selectedIndex = index_cntrl

1634 'Gaming Peripheral Type: None, Bundle, Cable, Care, Case, Cheat, Control, Customization,

1635 ' Memory, Multimedia, Networking, Not Applicable, Power, Sound

1636 .all.Item("_569820874_0").selectedIndex = index_peri

1637 '*******************************

1638 Case "XBOX_Console"

1639 '*******************************

1640 'CE and Accessory Primary Color

1641 .all.Item("_400508731_0").selectedIndex = index_prim

1642 'CE and Accessory Secondary Color

1643 .all.Item("_1555794249_0").selectedIndex = index_sec

1644 '*******************************

1645 Case "XBOX_SW"

1646 '*******************************

1647 'Game PlatForm: XBOX_360, event. XBOX

1648 .all.Item("_67462387_0").selectedIndex = 20

1649 'Genre: ACTION, ADULT, ADVENTURE, EDUCATIONAL, EMULATORS, FAMILY, ENTERTAINMENT, FIGHTING,

1650 ' MUSIC, HOME, OTHER, PUZZLE, RACING, REFERENCE, ROLE_PLAYING, SHOOTER, SIMULATION,

1651 ' SPORTS, STRATEGY, TRADITIONAL, UTILITY, VARIETY, WRESTLING, DEVELOPMENT TOOLS

1652 .all.Item("_373149557_0").selectedIndex = index_genre

1653 'Rating: AO, E, E10+, EC, G, INHALANT, M, NC_17, NOT_RATED, PG, PG_13, R, RATING_PENDING,

1654 ' RP, T, UN_RATED, X_RATED

1655 .all.Item("_1005868565_0").selectedIndex = index_rating

1656 'Street Date:

1657 k = 0

1658 Do While ArrMarketDataHeaders(k) <> "street date"

1659 k = k + 1

1660 Loop

1661 street_date = MarketingMatrix(i - 1, k) 'street date musi byt ve Formatu YYYY-MM-DD hh:mm:ss

1662 If street_date = "" Then 'If not street dated Then fill in MSD

1663 slashQ = 0

1664 MM = ""

1665 DD = ""

1666 YY = ""

1667 MyTime = Format(Time, "hh:mm:ss")

1668 For j = 0 To ColQuant - 1

1669 If ArrHeaders(j) = C_MSD Then

1670 If Len(MatrixPLfltrd(i, j)) <> 0 Then

1671 For iii = 1 To Len(MatrixPLfltrd(i, j))

1672 If Mid(MatrixPLfltrd(i, j), iii, 1) <> "/" And slashQ = 0 Then

1673 MM = MM + Mid(MatrixPLfltrd(i, j), iii, 1)

1674 End If

1675 If Mid(MatrixPLfltrd(i, j), iii, 1) <> "/" And slashQ = 1 Then

1676 DD = DD + Mid(MatrixPLfltrd(i, j), iii, 1)

1677 End If

1678 If Mid(MatrixPLfltrd(i, j), iii, 1) <> "/" And slashQ = 2 Then

1679 YY = YY + Mid(MatrixPLfltrd(i, j), iii, 1)

1680 End If

1681 If Mid(MatrixPLfltrd(i, j), iii, 1) = "/" Then

1682 slashQ = slashQ + 1

1683 End If

1684 Next iii

1685 If Len(MM) = 1 Then

1686 MM = "0" + MM

1687 End If

1688 If Len(DD) = 1 Then

1689 DD = "0" + DD

1690 End If

1691 .getElementsByTagName("Form")(0).getElementsByTagName("input")(116).Value = YY & "-"

& MM & "-" & DD & " " & MyTime

1692 End If

1693 End If

1694 Next j

1695 Else

1696 .getElementsByTagName("Form")(0).getElementsByTagName("input")(116).Value = street_date & " "

& MyTime

1697 End If

1698 BBuy_win = FindWindow(ByVal vbNullString, ByVal "Best Buy PIM Portal - Windows Internet

Explorer")

1699 Call SetFocusAPI(ByVal BBuy_win)

1700 For j = 1 To 300

1701 Call PostMessage(ByVal BBuy_win, ByVal WM_KEYDOWN, ByVal VK_TAB, ByVal 0&)

1702 Call PostMessage(ByVal BBuy_win, ByVal WM_KEYUP, ByVal VK_TAB, ByVal 0&)

1703 Sleep 100 'ms

1704 Next j

1705 'Number of Discs: 1

1706 .getElementById("_92864450_0").Value = 1

1707 '*******************************

1708 Case "Input_Devices-Game_Controller"

1709 '*******************************

1710 'Accessory Ind: None, No, Yes

1711 .all.Item("_648190504_0").selectedIndex = 2

1712 'CE and Accessory Primary Color

1713 .all.Item("_456433945_0").selectedIndex = index_prim

1714 'CE and Accessory Secondary Color

1715 .all.Item("_1627363851_0").selectedIndex = index_sec

1716 'Number of Buttons: None, 0, 1, 2, 3, 4, 5, 6

1717 k = 0

1718 Do While ArrMarketDataHeaders(k) <> "Number of Buttons"

1719 k = k + 1

1720 Loop

1721 Index = Val(MarketingMatrix(i - 1, k)) + 2

1722 .all.Item("_187851846_0").selectedIndex = Index

1723 '*******************************

1724 Case "Input_Devices-Mice"

1725 '*******************************

1726 'CE and Accessory Primary Color

1727 .all.Item("_480222994_0").selectedIndex = index_prim

1728 'CE and Accessory Secondary Color

1729 .all.Item("_851789664_0").selectedIndex = index_sec

1730 'Number of Buttons: None, 0, 1, 2, 3, 4, 5, 6

1731 k = 0

1732 Do While ArrMarketDataHeaders(k) <> "Number of Buttons"

1733 k = k + 1

1734 Loop

1735 Index = Val(MarketingMatrix(i - 1, k)) + 2

1736 .all.Item("_1331524015_0").selectedIndex = Index

1737 'Number of Programmable Buttons: None, 0, 1, 2, .... 12

1738 k = 0

1739 Do While ArrMarketDataHeaders(k) <> "Number of Programmable Buttons"

1740 k = k + 1

1741 Loop

1742 Index = Val(MarketingMatrix(i - 1, k)) + 2

1743 .all.Item("_222122316_0").selectedIndex = Index

1744 'Tilt Wheel: None, No, Yes

1745 k = 0

1746 Do While ArrMarketDataHeaders(k) <> "Tilt Wheel"

1747 k = k + 1

1748 Loop

1749 If MarketingMatrix(i - 1, k) = "Yes" Then

1750 .all.Item("_1057497258_0").selectedIndex = 2

1751 Else

1752 .all.Item("_1057497258_0").selectedIndex = 1

1753 End If

1754 'Type of Pointing Device: None, Ball, Laser, Not Applicable, Optical, Presenter Mouse

1755 k = 0

1756 Do While ArrMarketDataHeaders(k) <> "Type of Pointing Device"

1757 k = k + 1

1758 Loop

1759 Select Case MarketingMatrix(i - 1, k)

1760 Case "Ball": Index = 1

1761 Case "Bluetrack": Index = 2

1762 Case "Laser": Index = 3

1763 Case "Not Applicable": Index = 4

1764 Case "Optical": Index = 5

1765 Case "Presenter Mouse": Index = 6

1766 End Select

1767 .all.Item("_1914843709_0").selectedIndex = Index

1768 '*******************************

1769 Case "Input_Devices-Keyboards"

1770 '*******************************

1771 'Backlit Keys: None, No, Yes

1772 k = 0

1773 Do While ArrMarketDataHeaders(k) <> "Backlit Keys"

1774 k = k + 1

1775 Loop

1776 If MarketingMatrix(i - 1, k) = "Yes" Then

1777 .all.Item("_1840074102_0").selectedIndex = 2

1778 Else

1779 .all.Item("_1840074102_0").selectedIndex = 1

1780 End If

1781 'Battery Size: None, 9V, AA, AAA, C, D, Not Applicable, Photo, Specialty

1782 k = 0

1783 Do While ArrMarketDataHeaders(k) <> "Battery Size"

1784 k = k + 1

1785 Loop

1786 Select Case MarketingMatrix(i - 1, k)

1787 Case "9V": Index = 1

1788 Case "AA": Index = 2

1789 Case "AAA": Index = 3

1790 Case "C": Index = 4

1791 Case "D": Index = 5

1792 Case "Not Applicable": Index = 6

1793 Case "Photo": Index = 7

1794 Case "Specialty": Index = 8

1795 End Select

1796 .all.Item("_253158650_0").selectedIndex = Index

1797 'CE and Accessory Primary Color

1798 .all.Item("_834572842_0").selectedIndex = index_prim

1799 'CE and Accessory Secondary Color

1800 .all.Item("_2079577208_0").selectedIndex = index_sec

1801 'Mouse Included: None, Ball, Built Into Keyboard, Laser, No, Optical, Scroller,

1802 ' Wireless, Wireless Laser, Wireless Optical, Wireless Scroller

1803 k = 0

1804 Do While ArrMarketDataHeaders(k) <> "Mouse Included"

1805 k = k + 1

1806 Loop

1807 Select Case MarketingMatrix(i - 1, k)

1808 Case "Ball": Index = 1

1809 Case "Built Into Keyboard": Index = 2

1810 Case "Laser": Index = 3

1811 Case "No": Index = 4

1812 Case "Optical": Index = 5

1813 Case "Scroller": Index = 6

1814 Case "Wireless": Index = 7

1815 Case "Wireless Laser": Index = 8

1816 Case "Wireless Optical": Index = 9

1817 Case "Wireless Scroller": Index = 10

1818 End Select

1819 .all.Item("_417869597_0").selectedIndex = Index

1820 'Multimedia Keys: None, No, Yes

1821 k = 0

1822 Do While ArrMarketDataHeaders(k) <> "Multimedia Keys"

1823 k = k + 1

1824 Loop

1825 If MarketingMatrix(i - 1, k) = "Yes" Then

1826 .all.Item("_279444067_0").selectedIndex = 2

1827 Else

1828 .all.Item("_279444067_0").selectedIndex = 1

1829 End If

1830 'Number of Keys:

1831 k = 0

1832 Do While ArrMarketDataHeaders(k) <> "Number of Keys"

1833 k = k + 1

1834 Loop

1835 .getElementById("_2118570484_0").Value = MarketingMatrix(i - 1, k)

1836 'Number of USB Ports: None, 0, .. 10

1837 k = 0

1838 Do While ArrMarketDataHeaders(k) <> "Number of USB Ports"

1839 k = k + 1

1840 Loop

1841 Select Case MarketingMatrix(i - 1, k)

1842 Case "0": Index = 1

1843 Case "1": Index = 2

1844 Case "2": Index = 3

1845 Case "3": Index = 4

1846 Case "4": Index = 5

1847 Case "5": Index = 6

1848 Case "6": Index = 7

1849 Case "7": Index = 8

1850 Case "8": Index = 9

1851 Case "9": Index = 10

1852 Case "10": Index = 11

1853 End Select

1854 .all.Item("_743999170_0").selectedIndex = Index

1855 '*******************************

1856 Case "Web Cams"

1857 '*******************************

1858 'Built In Microphone: None, No, Yes

1859 k = 0

1860 Do While ArrMarketDataHeaders(k) <> "Built In Microphone"

1861 k = k + 1

1862 Loop

1863 If MarketingMatrix(i - 1, k) = "Yes" Then

1864 .all.Item("_947613075_0").selectedIndex = 2

1865 Else

1866 .all.Item("_947613075_0").selectedIndex = 1

1867 End If

1868 'CE and Accessory Primary Color

1869 .all.Item("_1731412480_0").selectedIndex = index_prim

1870 'CE and Accessory Secondary Color

1871 .all.Item("_654042830_0").selectedIndex = index_sec

1872 'Headphone Connection: None, Mini Stereo, Not Applicable, RCA, Wireless

1873 k = 0

1874 Do While ArrMarketDataHeaders(k) <> "Headphone Connection"

1875 k = k + 1

1876 Loop

1877 Select Case MarketingMatrix(i - 1, k)

1878 Case "Mini Stereo": Index = 1

1879 Case "Not Applicable": Index = 2

1880 Case "RCA": Index = 3

1881 Case "Wireless": Index = 4

1882 End Select

1883 .all.Item("_1239705568_0").selectedIndex = Index

1884 'Headset Included: None, No, Yes

1885 k = 0

1886 Do While ArrMarketDataHeaders(k) <> "Headset Included"

1887 k = k + 1

1888 Loop

1889 If MarketingMatrix(i - 1, k) = "Yes" Then

1890 .all.Item("_1627316746_0").selectedIndex = 2

1891 Else

1892 .all.Item("_1627316746_0").selectedIndex = 1

1893 End If

1894 'Software Included: None, Data Recovery Software, Educational Software,

1895 ' Facial Recognition Software, Music Management Software,

1896 ' Navigation Software, Not Applicable, Photo Editing Software,

1897 ' Video Effects Software

1898 k = 0

1899 Do While ArrMarketDataHeaders(k) <> "Software Included"

1900 k = k + 1

1901 Loop

1902 Select Case MarketingMatrix(i - 1, k)

1903 Case "Data Recovery Software": Index = 1

1904 Case "Educational Software": Index = 2

1905 Case "Facial Recognition Software": Index = 3

1906 Case "Music Management Software": Index = 4

1907 Case "Navigation Software": Index = 5

1908 Case "Not Applicable": Index = 6

1909 Case "Photo Editing Software": Index = 7

1910 Case "Video Effects Software": Index = 8

1911 End Select

1912 .all.Item("_1579521051_0").selectedIndex = Index

1913 'Webcam Design: None, Desktop, Laptop, Not Applicable

1914 k = 0

1915 Do While ArrMarketDataHeaders(k) <> "Webcam Design"

1916 k = k + 1

1917 Loop

1918 Select Case MarketingMatrix(i - 1, k)

1919 Case "Desktop": Index = 1

1920 Case "Laptop": Index = 2

1921 Case "Not Applicable": Index = 3

1922 End Select

1923 .all.Item("_1402083757_0").selectedIndex = Index

1924 '*******************************

1925 End Select 'kategorie

1926 Application.Wait (Now + TimeValue("0:00:3"))

1927 '******* SAVE Category Tab ****************

1928 .all.Item("PC_7_0_J3_SAVE").Click: Call is_busy(IE)

1929 End With

1930

1931 'searching For PIM Id's and loading them into an array variable:

1932 j = 0

1933 ReDim Preserve PIMId(i - 1)

1934 Do While IE.Document.all.tags("td")(j).innerTEXT <> "PIM Id"

1935 PIMId(i - 1) = IE.Document.all.tags("td")(j + 1).innerTEXT

1936 j = j + 1

1937 If PIMId(i - 1) = "PIM Id" Then

1938 PIMId(i - 1) = IE.Document.all.tags("td")(j + 1).innerTEXT

1939 PIMId(i - 1) = Mid(PIMId(i - 1), 2, 10) 'PIM Id ma 10 cifer, zacina mezerou

1940 End If

1941 Loop

1942

1943 '*** HOME ***

1944

1945 IE.navigate

"https://pimportal.bestbuy.com/wps/myportal/!ut/p/kcxml/04_Sj9SPykssy0xPLMnMz0vM0Y_QjzKLN4h39gDJgFjGpvqRqCKOcIEg

fW99X4_83FT9AP2C3NCIckdHRQBrdSb8/delta/base64xml/L3dJdyEvd0ZNQUFzQUMvNElVRS82XzBfQ0g!"

1946 Call is_busy(IE)

1947 'End If {ArrOfPLind(i - 1) = True Then}

1948 done_1 = True

1949 Next i 'setup the Next SKU

1950 Do While IE.Busy And Not IE.ReadyState = 4: DoEvents: Loop 'or Call is_busy(IE)

1951 'click on Item Induction

1952 'RUN the JAVASCRIPT Function from Within VBA (Function PC_7_0_IS_openURL in the HTML)

1953 Application.Wait (Now + TimeValue("0:00:3"))

1954 IE.Document.all.Item

1955 Call IE.Document.parentWindow.execScript("javascript:PC_7_0_IS_openURL('Item Induction')", "JavaScript")

1956 Call is_busy(IE)

1957 'UPDATE ***************

1958 IE.Document.all.Item("PC_7_0_J1_WORKFLOW_SELECT").Click: Call is_busy(IE)

1959 'Complete Non Data Pool Item ********************

1960 IE.navigate

"https://pimportal.bestbuy.com/wps/myportal/!ut/p/kcxml/04_Sj9SPykssy0xPLMnMz0vM0Y_QjzKLN4h39gLJgFjGpvqRqCKOcAFf

j_zcVP0gfW_9AP2C3NCIckdHRQAl6aCR/delta/base64xml/L0lDU0lKQ1RPN29na21DU1Evb0tvUUFBSVFnakZJQUFRaENFSVFqR0VKemdBIS8

0SkZpQ28wZWgxaWNvblFWR2hkLXNJZDJFQSEhLzdfMF9KMS8yNzIvc2EuU1RFUE5BTUU!?PC_7_0_J1_STEPNAME=Complete%20Non%20Data%2

0Pool%20Item&PC_7_0_J1_COLLABAREA_ID=Item%20Induction&PC_7_0_J1_WORKFLOW_ID=Item%20Induction%20Workflow%20v1#7_0

_J1"

1961 Call is_busy(IE)

1962 'Zaskrtnout jen ty checkbox s danou value PIM Id - muzou tam byt neodeslane SKU

1963 'Potreba nacist PIM ID na zacatku do pole a vyuzit zde i pak v mailu

1964 Application.Wait (Now + TimeValue("0:00:3"))

1965 For i = 0 To SetUpQuant - 1

1966 j = 0

1967 Do While IE.Document.all.tags("td")(j).innerTEXT <> PIMId(i)

1968 'getElementsByValue("Google Search").Item(0).submit - VBA nepozna getelementsbyvalue???

1969 j = j + 1

1970 If IE.Document.all.tags("td")(j).innerTEXT = PIMId(i) Then

1971 IE.Document.getElementsByTagName("td")(j - 1).getElementsByTagName("input")(0).Checked = True

1972 End If

1973 Loop

1974 Do While IE.Busy And Not IE.ReadyState = 4: DoEvents: Loop

1975 Next i

1976 Do While IE.Busy And Not IE.ReadyState = 4: DoEvents: Loop 'Call is_busy(IE) equival

1977

1978 'SUBMIT at once or in a cycle and wait 3 min for each? - at once possible

1979 'IE.Document.all.Item("NEXT_STEP_LIST_BUTTON_0").Click: Call is_busy(IE)

1980 done_2 = True

1981 'LOG OUT

1982 IE.navigate

"https://pimportal.bestbuy.com/wps/myportal/!ut/p/kcxml/04_Sj9SPykssy0xPLMnMz0vM0Y_QjzKLN4h39gLJgFjGpvqRqCKOcAFf

j_zcVP0goESkOVDEy1A_Kic1PTG5Uj9Y31s_QL8gNzSi3NvREQD-ps-

S/delta/base64xml/L0lKSklKSWchL0lCakFBR3lBQkVRaUlBISEvNElENnhCX1dFTkRDLzEwOTUvMTM3NzIvbG8!"

1983 IE.Quit 'zavrit browser

1984 Set IE = Nothing 'znicit objekt

1985

1986 Else 'je-li SetUpQuant = 0 nevytvori se ani instance internet exploreru

1987 zprava = "The requested SKU/SKUs is/are not on the BestBuy PC PL" 'none of them

1988 done_3 = True 'kontrola, ze nenastala chyba logovani do IE, ale SetUpQuant je opravdu 0

1989 End If

1990 Application.ScreenUpdating = True

1991

1992 'I have included the DisplayAlerts statement because Excel

1993 'could ask whether to save Workbook changes first

1994 '*********************************************************************************

1995 Exit Sub 'pri cteni souboru muze teoreticky nastat nasledujici

1996 Chyby:

1997 'If Err.Number = 68 Then

1998 ' MsgBox "The device is not accessible."

1999 'Else

2000 ' MsgBox "Sorry, an unexpected error has occurred: " & Error()

2001 'End If

2002 'Application.DisplayAlerts = False

2003 'Application.Quit

2004 nelzeulozit:

2005 'If Err.Number <> 0 Then

2006 ' MsgBox "The Form has not been saved."

2007 'End If

2008 'Application.DisplayAlerts = False

2009 'Application.Quit

2010 End Sub

2011

2012 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

2013 '@@@@@@@@@@@@ @@@@@@@@@@@

2014 '@@@@ AUTHOR: Ales VYMYSLICKY @@@@@@@@@@@

2015 '@@@@ The entire code was written by the author and is an intellectual property of its author.

2016 '@@@@@@@@@@@@ @@@@@@@@@@@

2017 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

2018 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

2019 '@@@@@@@@@@@@ @@@@@@@@@@@

2020 '@@@@@@@@@@@@ COPYRIGHT - ALES VYMYSLICKY @@@@@@@@@@@

2021 '@@@@@@@@@@@@ @@@@@@@@@@@

2022 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@