Link to home
Start Free TrialLog in
Avatar of Jaziar
Jaziar

asked on

Is it possible to import and export to a Excel Spreadsheet

I have a database that people are wanting to import infomation to and from a spreadsheet.  Is this possible.  This is just a question - if it is I will sumbit A new question with a bunch of points and more details.  I just want to know if it is possible and hard is it to do?
ASKER CERTIFIED SOLUTION
Avatar of Arunkumar
Arunkumar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Arunkumar
Arunkumar

Something to ponder if you need to code.  Here is something i got from my old system....


Sub ExportToExcel
      
      On Error Goto ErrorHandler
      
      Dim ws As New NotesUIWorkSpace
      Dim uiView As NotesUIView
      Dim vw As NotesView
      Dim doc As NotesDocument      
      Dim oexcel As Variant
      Dim oworkbook As Variant
      Dim xlSheet As Variant
      
      Dim row As Integer
      Dim col As Integer      
      Dim hdg List As String
      Dim leng List As Variant
      Dim fileName As String
      
      Set uiView = ws.CurrentView
      Set vw = uiView.View
      Set doc = vw.getfirstdocument
      
      hdg(0) = "Dealer Name"
      hdg(1) ="Dealer Legal Name"
      hdg(2)="Dealer Code"
      hdg(3)="Location Address"
      hdg(4)="Zip Code"
      hdg(5)="City"
      hdg(6)="State"
      hdg(7)="Phone"
      hdg(8)="Fax"
      hdg(9)="President Name"
      hdg(10)="Sales Mgr. Name"
      hdg(11)="Contract Signed"
      hdg(12)="DC Vans Regional Sales Mgr."
      
      leng(0) = 38.5
      leng(1) = 38.5
      leng(2) = 9.5
      leng(3) = 28.0
      leng(4) = 9.0
      leng(5) = 18.5
      leng(6) = 7.0
      leng(7) = 13.67      
      leng(8) = 13.67
      leng(9) = 17.5
      leng(10) = 14.0
      leng(11) = 12.5
      leng(12) = 19.33                                    
      
'      fileName$ = Environ$("APPDATA") & "\Export.xls"
'      fileName$ = Inputbox$( |The file will be extracted in the following location.  
'Please change it as applicable| , "Export Location" , fileName$  )
      
      Set oexcel = createobject("Excel.Application")
      Set oworkbook = oexcel.WorkBooks
      oworkbook.Add
      
      Set xlSheet = oexcel.Workbooks(1).Worksheets(1)
      
      col = 1
      row = 1
      Forall h In hdg            
            
            oexcel.cells(row,col).columnwidth = leng( col - 1) ' Column width
            oexcel.Columns(col).VerticalAlignment = 1
            oexcel.Cells(row, col).Font.Underline = 2 ' UnderLining the Heading            
            oexcel.Cells(row, col).Font.Bold =  True ' Bold
            oexcel.cells(row,col).WrapText = True 'Wrap Text
            oexcel.Cells(row,col) = Ucase(h) ' UpperCase Heading
            
            
            col = col + 1
      End Forall
      
      row = row + 2
      col = 1
      
      Do While Not doc Is Nothing
            
            If Trim(doc.TerminatedContract_1_2(0)) = "" Then
                  
                  oexcel.cells(row,col) =  doc.ce_marca_1_1_2_1(0)            
                  oexcel.cells(row,col).WrapText = True
                  col = col + 1
                  oexcel.cells(row,col) = doc.LegalName_1_2(0)
                  oexcel.cells(row,col).WrapText = True
                  col = col + 1
                  oexcel.cells(row,col) = doc.ce_marca_1_1_2(0)
                  oexcel.cells(row,col).WrapText = True
                  col = col + 1
                  oexcel.cells(row,col) = doc.ce_dir_1_1_1(0)
                  oexcel.cells(row,col).WrapText = True
                  col = col + 1
                  oexcel.cells(row,col) = doc.ce_cp_1_2_1(0)
                  oexcel.cells(row,col).WrapText = True
                  col = col + 1
                  oexcel.cells(row,col) = doc.ce_loc_1_1_1(0)
                  oexcel.cells(row,col).WrapText = True
                  col = col + 1
                  oexcel.cells(row,col) = doc.ce_pro_1_2_1(0)
                  oexcel.cells(row,col).WrapText = True
                  col = col + 1
                  oexcel.cells(row,col) = doc.ce_tel_1_1_1(0)
                  oexcel.cells(row,col).WrapText = True
                  col = col + 1
                  oexcel.cells(row,col) = doc.ce_fax_1_1_1(0)
                  oexcel.cells(row,col).WrapText = True
                  col = col + 1
                  oexcel.cells(row,col) = doc.ce_gerente_1_1_1(0)
                  oexcel.cells(row,col).WrapText = True
                  col = col + 1
                  oexcel.cells(row,col) = doc.SalesManager_1_1(0)
                  oexcel.cells(row,col).WrapText = True
                  col = col + 1
                  oexcel.cells(row,col) = doc.SignedContract_1_2(0)
                  oexcel.cells(row,col).WrapText = True            
                  col = col + 1
                  oexcel.cells(row,col) = doc.ce_resvent_au_1_1_1(0)                                                            
                  oexcel.cells(row,col).WrapText = True
                  row = row+1
                  col = 1
            End If
            Set doc = vw.getnextdocument(doc)
      Loop
      
'Display a message telling the user their file is ready
'      Msgbox "Excel file available at : " & fileName$ , 64, "DC Vans Dealers : Your Excel file is ready!"
'      oexcel.activeworkbook.saveas fileName$
'Show the excel application we started in the background
      oexcel.visible = True            
      
      
      oexcel.activeworkbook.close(1)
      
'      Call oexcel.quit
      Set oexcel = Nothing      
      
      Exit Sub      
ErrorHandler:
      Messagebox Error$ , 64 , Err()
      Exit Sub
End Sub
SOLUTION
Avatar of TSO Fong
TSO Fong
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Note that this code puts two roles in the AuthorsField field, which is of course an Authors field. (The field is called AuthorsField instead of Authors to avoid conflicts with doc.Authors in other scripts.) Users with those roles assigned in the ACL have the authority to see these views and to perform the imports, or to edit the records once they're imported.

-- b.r.t.
Wow, you people know how to make a point.  Even a small one in a big way.  'scuse me, gotta make some molehills out of a mountain.
Avatar of Jaziar

ASKER

Im still here - Not addressing that database at this time - but when I get to it - I will use this thread, so I am uping the points.
Thats good Jaziar, Keep me in mind to accept the answer from !

;-P

I'm in no hurry either. Take your time.
-- b.r.t.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Me too...
Arun,

You would definitely be me too and the gimme gimmes.  Because somebody does it better.

qwaletee
Just kidding.  Anyone catch the obscure reference?
Of "me to and the gimme gimmes"? Possibly the best cover band of all times?
Nope. I missed that one.
Me FIRST and the Gimme Gimmes.  And, of course, as you say, Nobody Does It Better.

Best punk cover anyway :)

My fav is Puff the Magic Dragon.  Blows my mind.
Yes, my bad on the First.

I don't have Puff in my collection, I'm afraid. "Rainbow Connection" has always been a favorite, but I have a special place in my heart for the Paul Simon stuff. Meanwhile, "California Dreaming" always calls the Dead Milkmen's "Punk Rock Girl" to mind, which is usually a good thing. It's just too hard to pick a single favorite.

This is sounding more and more like a Lounge conversation.
I dunno... punk rock lounge?  Seems like an oxymoron.
Avatar of Jaziar

ASKER

This problem has been kicked out - I am going to just split up the points
I didn't deserve any points for this.
Avatar of Jaziar

ASKER

I did not use anyone's comments - I gave a greater number of points to the ones with the most text or who I thought gave it the college try.  I want everyone that takes the time to comment be able to get something for thier time - even though it may not lead to correct answers.  I have enjoyed the services of this forum many times and I am sure each and everyone of you have at one time answered a question of mine.  If indeed I did use someones comment that would have gotten a the points.
What I meant was, i didn't even say anything technical here.  All my comments were about punk rock, people who act like a punk rock band, or a snide comment about mountains and molehills.

Maybe I'll just take the points for General Purpose Creativity.  Or language creativity.
Avatar of Jaziar

ASKER

This comment gave me a laugh

Wow, you people know how to make a point.  Even a small one in a big way.  'scuse me, gotta make some molehills out of a mountain.

So I gave points for that
I had myself LOL when I wrote that.  Or was I laughing at the poor blokes who dribbled this one out to eight pages?