클립 보드에서 데이터를 복사 한 다음이를 배열에 저장하고 배열에서 가져온 내용을 Outlook 제목 줄에 복사하려고합니다. 나는 아웃룩 제목 줄에 ARRAY로 데이터를 복사하는 데 어려움을 겪고있다. 여기 내 코드가있다.클립 보드에서 배열 및 Visual Basic의 배열에서 Outlook 제목 줄로 복사
DoCmd.Minimize
DoCmd.OpenReport " INFORMATION", acViewReport, "", "", acNormal
DoCmd.RunCommand acCmdSelectAllRecords
DoCmd.RunCommand acCmdCopy
Btn_BundleInformation_Click_look:
Dim LString As String
Dim LArray() As String
Dim OutApp As Object
Dim OutMail As Object
Dim olInsp As Object
Dim wdDoc As Object
Dim oRng As Object
Dim olapp As Object
Dim strsubject As String
Dim strArray(1 To 5) As String
Dim B As Integer
Dim Sn As String
Dim Rq As String
Dim J As String
Dim PP As String
J = JOB#
B = BUNDLE#
Sn = SEGMENTNAME
Rq = RECORDQTY
PP = PlatformProject
'Dim arrA As Variant
Dim strString
'arrA = Array("BUNDLE#", "SEGMENTNAME", "RECORDQTY", "PlatformProject")
Dim varArray() As String
varArray() = Split("BUNDLE#;CREATION DATE;BUNDLE TYPE;Spring;JOB #;PKG(s);SEGMENT NAME:COMPARED TO BUNDLE;PCR VERSION;MAPPING VERSION;OSE # & Version;RECORD QTY;Platform Project;", ";")
On Error Resume Next
Set OutApp = GetObject(, "Outlook.Application")
'rst.Close
On Error GoTo 0
If Not olapp Is Nothing Then
'Outlook is open!
'MsgBox "Outlook is running"
Else
'Outlook not open
'MsgBox "Outlook is not running"
Shell ("OUTLOOK")
End If
'end check outlook
'open new mail
Set OutApp = CreateObject("Outlook.Application")
Dim DataObj As MsForms.DataObject
Set DataObj = MsForms.DataObject
On Error Resume Next
'Get data from the clipboard.
DataObj.GetFromClipboard
'Get clipboard contents
LString = DataObj.GetText
LArray = Split(LString)
On Error Resume Next
With OutMail
.BodyFormat = 3
.TO = ""
.CC = ""
.BCC = ""
.subject =
Set olInsp = .GetInspector
Set wdDoc = olInsp.WordEditor
Set oRng = wdDoc.Range
oRng.collapse 1
oRng.Paste
.display
End With
On Error GoTo 0
'Deassign all objects.
OutApp.Session.Logoff
Set OutMail = Nothing
Set OutApp = Nothing
Set olInsp = Nothing
Set wdDoc = Nothing
Set oRng = Nothing
'Set rst = Nothing
'Set db = Nothing
End Sub
사이의 어떤 다른 텍스트? 어떤 요소를 지정하려고합니까? 제목은 단지 하나의 요소 일뿐입니다. 배열의 크기는 얼마나됩니까? 배열의 위치를 아는 경우 (제목이 0 인 경우) – dbmitch
@dbmitch 인 경우에만 '제목 = LArray (#)'을 사용할 수 있습니다. 방금 배열의 내용이 어떻게 표시되는지 업데이트했습니다. 제목을 일부 항목에 복사하려면 어떻게해야합니까? – Becca
같은 정보가 적용됩니다 - 'Dim varArray() As String'이 아니라 배열을 다르게 희미하게하는 것을 제외하고'Dim varArray As Variant'를 사용하십시오 .. "CREATION DATE"를 표시하려면'varArray (1)'- 0부터 시작하는 배열의 두 번째 요소 – dbmitch