synch an xl document with Lotus Notes

nu_2-xl

New Member
Joined
Feb 5, 2009
Messages
1
Hello everyone,
I am trying to automatically gather data from lotus notes database and copy it into a speciifc tab in my xl doc. I am trying to write a macro that does that. I was told to create a record set and grab all data then manipulate it any way you want. Please help with some code.
the view I want has bunch of columns and I am ok getting everything all at once.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
I am trying to do the same thing, but I do not have an answer yet. The basics are create an ODBC connection with Lotus Notes Connection string. Query the date, and copy and import a recordset. Here is how I did it for Oracle if it helps.

Sub GetData()

Dim strConnection As String
Dim cn As ADODB.Connection
Dim SQLStr As String
Dim rs As ADODB.Recordset
Dim Server_Name As String
Dim User_ID As String
Dim Password As String
Dim Policy_Number As String
Dim Valuation_Date As String
Dim From_Date As String
Dim Through_Date As String


Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
Server_Name = "Nameofyourserver"
User_ID = "YourID"
Password = "yourpasscode"

Policy_Number = "'" & Worksheets("General Information").Range("Policy_Number").Text & "'"
Valuation_Date = "'" & UCase(Format(Worksheets("Period Determination").Range("Valuation_Date").Value, "dd-mmm-yyyy")) & "'"
From_Date = "'" & UCase(Format(Worksheets("Period Determination").Range("From_Date").Value, "dd-mmm-yyyy")) & "'"
Through_Date = "'" & UCase(Format(Worksheets("Period Determination").Range("Valuation_Date").Value, "dd-mmm-yyyy")) & "'"

'Oracle connection string
strConnection = "Driver={Microsoft ODBC for Oracle};" & _
"Server=" & Server_Name & ";uid=" & User_ID & ";pwd=" & Password & ";"
'SQL
'SQLStr = "Select * from LTDRES.RSRV_TABLE_KEYS"

SQLStr = "select * from table"

'Open Connection
cn.Open strConnection
'Query and stage data
rs.Open SQLStr, cn, adOpenStatic
'Put Data in Excel
With Worksheets("Sheet2").Cells
.ClearContents
.CopyFromRecordset rs
End With
'Clear Stored Data
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing

End Sub
 
Upvote 0

Forum statistics

Threads
1,215,757
Messages
6,126,695
Members
449,331
Latest member
smckenzie2016

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top