【问题标题】:How can I automate PeopleSoft using Excel VBA?如何使用 Excel VBA 自动化 PeopleSoft?
【发布时间】:2012-07-31 15:11:40
【问题描述】:

我在电子表格中有一个人员列表和他们的电子邮件,我需要将他们的电子邮件输入到他们在 People Soft V8 上的帐户中。它们有数千个,所以我希望将这个过程自动化。

我已经开始使用以下代码,但一直在获得

运行时错误
自动化错误 未指定的错误

Sub GoToWebSiteUpdate()
Dim appIE As InternetExplorer
Dim sURL As String
Dim UserN As Variant
Dim myLoginID As String

Set appIE = New InternetExplorer
sURL = "Webaddress"
appIE.navigate sURL
appIE.Visible = True

     'Enter information in the first drop down
    Set UserN = appIE.document.getElementsById("InputBox")
    UserN(0).Value = "012354"


Set appIE = Nothing
End Sub

如果有人有任何很棒的想法,谢谢。

【问题讨论】:

  • PeopleSoft 没有某种电子邮件/数据导入系统吗?我不知道你为什么需要 VBA。您只需创建您的电子邮件数据并将其导入。peoplesoft.wikidot.com/data-mover-script-templates
  • 它确实有一个导入系统,但是,我只需要修改系统中已经存在的电子邮件。不只是导入表。这种方法会支持类似的东西还是有其他方法可以做到这一点?我基本上只需要在表单中填写几个字段,然后点击保存
  • 您需要导入已更正电子邮件的表格。老实说,我不知道 excel VBA 会如何帮助你——假设你已经有了一个人的电子邮件列表。您只需将该数据导入 PeopleSoft(通过导入)。

标签: excel vba peoplesoft


【解决方案1】:

有几种非常简单的方法可以做到这一点。

1) 快速而肮脏的方式: 使用 Excel 公式(在每行的最后一个单元格中)将值连接到 SQL 语句中(每行 1 个)。然后,您可以在您选择的 SQL 工具中运行它们。

2)“正确”的方法: 使用 ExcelToCI。这是一个 Excel 上传工具,它将运行所有页面验证等。它的内容比我在这里写的要多,但这是 PeopleBooks 中有关它的部分的链接: http://docs.oracle.com/cd/E28394_01/pt852pbh1/eng/psbooks/tcpi/book.htm?File=tcpi/htm/tcpi10.htm#H3002

亲切的问候

邓肯

【讨论】:

    【解决方案2】:

    我用来从 peoplesoft 提取报告的实际工作代码。代码是通过在互联网上查找各种博客和代码库准备的

    代码将遍历数据范围,即开始日期和结束日期,并生成数据提取。因为 Psoft 不能在提取中提供超过 65K 行,所以我让它一次运行 7 天。

    Public Declare PtrSafe Function SetForegroundWindow Lib "user32" (ByVal HWND As Long) As Long
    
    Sub PPS_Report_Extractor()
    
    Dim Cell, Rng As Range   'Declaring cell for looping thru date range
    'Dim appIE As Object      'InternetExplorer.Application
    Dim appIE As InternetExplorer
    Dim sURL As String       'URL String
    Dim Element As Object    'HTMLButtonElement
    Dim btnInput As Object   'MSHTML.HTMLInputElement
    Dim ElementCol As Object 'MSHTML.IHTMLElementCollection
    Dim Link As Object       'MSHTML.HTMLAnchorElement
    Dim Counter, myNum       'Add Counter
        Counter = 0          'Declare Start for Counter
        myNum = 147          'Declare the number of repitition required
    
    RemNamedRanges 'Delete the older ranges
    
    '---Set New Range of reporting start dates -----
    Range("A1").Offset(1, 0).Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Name = "ElementCol"
    
    Set Rng = Worksheets("Sheet1").Range("Elementcol")
    
    '---Launch the IE -----
    ' Set appIE = CreateObject("InternetExplorer.Application")
    Set appIE = New InternetExplorerMedium
    
    
    sURL = "" ' open the URL by loggin intot PPS query then past that url here
    
    appIE.Navigate sURL
    appIE.Visible = True
    
    'While appIE.Busy
    '    DoEvents
    'Wend
    
    Pause (5) 'Allow IE to load
    
    SendKeys "{ENTER}" 'Hit log on button in IE
    
    '-Loop to generate the Files for full year starts here ---
    
    For Each Cell In Rng
    
    A = Format(Cell.Value, "DD-MM-YYYY")
    B = Format(Cell.Offset(0, 1).Value, "DD-MM-YYYY")
    '----Code for extraction ---START---
    
    Application.Wait Now + TimeValue("00:00:5")
    'Pause (5) 'Allow IE to load
    
    appIE.Document.getelementbyid("InputKeys_bind2").Value = A
    appIE.Document.getelementbyid("InputKeys_bind3").Value = B
    appIE.Document.getelementbyid("#ICQryDownloadExcelFrmPrompt").Click
    
    Pause (5)
    SendKeys "{ENTER}", 5
    
    '---Wait for excel generation to complete
    
    I = 0
    Set fo = CreateObject("Scripting.FileSystemObject")
    Do Until fo.FileExists(OutFile) 'Loop until the output file is created, this could be infinity if there is a problem
        Application.Wait (Now + TimeValue("0:00:2")) 'Holds the program for 2 seconds
        DoEvents
        I = I + 1
        If (I = 10) Then
        SendKeys "%S" 'Alt S to save the report
        GoTo 1
        End If
    Loop
    1
    '----Code for extraction ---END---
    Next Cell
    
    '-Loop to generate the Files for full year Ends here here ---
    
    MsgBox "The range has " & K & " rows."
    
    
    End Sub
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-10-10
      • 1970-01-01
      • 1970-01-01
      • 2020-01-16
      • 2013-10-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多