Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to merge columns from excel and how to set customize each columns

Hi To All !

Good Day,


I have a code that will generate report from Notes to Excel but I'm
having a problem a problem in merging the column as well as the
customization of data that was being exported from excel.

here's my sample code :

Dim Session As New NotesSession
Dim db As NotesDatabase
Dim sourceview As NotesView
Dim sourcedoc As NotesDocument
Dim dataview As NotesView
Dim dc As NotesDocumentCollection
Dim datadoc As NotesDocument
Dim maxcols As Integer
Dim ws As New Notesuiworkspace
Dim UiView As notesuiview
Dim ViewString As String
Dim EnvProfile As String

Set UiView=WS.currentview
Set db = session.CurrentDatabase
ViewString=UiView.viewname

'Selection of Control No to print
Dim SelectedItem As Variant
Dim Sview As notesview
Dim SDoc As notesdocument
SelectedItem = ws.Pickliststrings(3,False,db.Server,db.FilePath," Risk
Main Entry", "Printing Document...","Select Control No.",5)
'End Selection


If SelectedItem(0) < "" Then
Set dc = db.unprocesseddocuments
Set dataview = db.getview(ViewString)
xCont = "yes"
Dim xlApp As Variant
Dim xlsheet As Variant
Dim rows As Integer
Dim cols As Integer
rows = 1
cols = 1
max1 = 20
max2=max1
maxcols=Cint(max2)

Set xlApp = CreateObject("Excel.Application")
xlApp.StatusBar = "Creating WorkSheet. Please be patient..."
xlApp.Visible = True
xlApp.Workbooks.Add
xlApp.ReferenceStyle = 2
Set xlsheet = xlApp.Workbooks(1).Worksheets(1)
xlsheet.Name = "For Printing Document"
xlApp.StatusBar = "Creating Column Heading. Please be patient..."
' for headings
cols = 1
rows = 1
xlsheet.Cells(rows,cols).Value = "Unit/Dept"
xlsheet.Cells(rows,cols+1).Value = "Asset Type"
xlsheet.Cells(rows,cols+2).Value = "Asset ID"
xlsheet.Cells(rows,cols+3).Value = "Asset Name"
xlsheet.Cells(rows,cols+4).Value = "Threat"
xlsheet.Cells(rows,cols+5).Value = "Vulnerability"
'end for headings
Set SView = db.GetView("Risk Item Embedded (Main Entry)")
Set datadoc = SView.getdocumentbykey(SelectedItem)
cols=1
rows=3
Do While Not (datadoc Is Nothing) And xCont = "yes"
xlsheet.Cells(rows,cols).Value =
datadoc.GetItemValue("UniDept")
xlsheet.Cells(rows,cols+1).Value =
datadoc.GetItemValue("AType")
xlsheet.Cells(rows,cols+2).Value =
datadoc.GetItemValue("AssID")
xlsheet.Cells(rows,cols+3).Value =
datadoc.GetItemValue("AssName")
xlsheet.Cells(rows,cols+4).Value =
datadoc.GetItemValue("Threat")
xlsheet.Cells(rows,cols+5).Value =
datadoc.GetItemValue("Vulnerability")
xlApp.StatusBar = "Importing Notes Data - Document " &
rows-1 & "."
rows=rows+1
cols=1
Set datadoc = SView.getnextdocument(datadoc)
If datadoc.Maindoc(0) < SelectedItem(0) Then
xcont = "no"
End If
Loop

xlApp.Rows("1:1").Select
xlApp.Selection.Font.Bold = True
xlApp.Selection.Font.Underline = True
xlApp.Range(xlsheet.Cells(1,1),
xlsheet.Cells(rows,maxcols)).Select
xlApp.Selection.Font.Name = "Arial"
xlApp.Selection.Font.Size = 9
xlApp.Selection.Columns.AutoFit
xlApp.ReferenceStyle = 1
xlApp.Range("A1").Select
xlApp.StatusBar = "Importing Data from Lotus Notes Application
was Completed."
End If

Please help me on how to merge the excel columns as well as in
customizing the size to columns for the exported data becasue I will
use this as Printing of report.

Thank you in advance,

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Customize number of rows and columns Tuckland Excel Discussion (Misc queries) 3 May 8th 07 11:25 AM
Excel merge columns Myrto New Users to Excel 1 November 15th 06 03:44 AM
merge text from 2 columns into 1 then delete the old 2 columns sleepindogg Excel Worksheet Functions 4 March 30th 06 07:25 PM
how do you merge two columns in excel SheE Excel Discussion (Misc queries) 2 February 11th 05 04:17 PM
how do you merge two columns in excel SheE Excel Discussion (Misc queries) 1 February 11th 05 03:46 PM


All times are GMT +1. The time now is 08:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"