VBA Macro to VBScript

Simpler45

New Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Help how to translate all of the code in VBScript

Sub Perenos_Kontaktov_iz_Excel()
Dim objXls As Object
Dim i As Single, j As Single
Dim myNameSpace As NameSpace
Dim myFolder As MAPIFolder, myWorkFolder As MAPIFolder
Dim myOutlook As Outlook.Application
Dim myItems As ContactItem
Set objXls = CreateObject("Excel.Application")
objXls.Workbooks.Open "D:\DataBase.xls"
'укажите путь и имя существующего файла
objXls.Application.Visible = False
Set myOutlook = CreateObject("Outlook.Application")
j = objXls.ActiveSheet.UsedRange.Rows.Count
For i = 1 To j
Set myItems = myOutlook.CreateItem(olContactItem)
With myItems
.FullName = objXls.ActiveSheet.Range("A" & i).Value & " " & _
objXls.ActiveSheet.Range("B" & i).Value & " " & _
objXls.ActiveSheet.Range("C" & i).Value
.Birthday = objXls.ActiveSheet.Range("D" & i).Value
.Email1Address = objXls.ActiveSheet.Range("E" & i).Value
.Save
End With
Next i
Set objXls = Nothing
Set myOutlook = Nothing
End Sub
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
I'm not good at localization - I thought the only thing that would need to be changed is the file path - the English functions should work. It doesn't have date and other number formats that would cause issues.

http://www.oaltd.co.uk/ExcelProgRef/Ch22/ProgRefCh22.htm has some information about localizing Excel. It's for an older version but much of it applies to all versions.

If I'm wrong (highly possible :)), where does it error?
 

Top