Novo

Forum kao aplikacija na telefonu

Dodajte forum na početni ekran i koristite ga kao aplikaciju, sa menijem na dnu ekrana.

  • 2 odgovora
  • 5.181 pregleda

Najnovija ↓

msflexGrid u Excel 26.02.2004. u 19:47 · pre 276 meseci #1
Kako da exportujem moju msflexgrid tabelu i msChart u Excel ili Word?
Re: msflexGrid u Excel 27.02.2004. u 10:48 · pre 276 meseci #2

Pa probaj ovako:

Code:


Public Sub MSFExportToWord(ByRef nekimsflexgrid As MSFlexGrid, ByRef imedokumentazasnimanje)

'######################################################
'
'           DONE BY DEJAN  26.02.2002
'
'  Funkcija prebacuje ceo msf u neki word dokument i snima ga pod datim nazivom
'
'######################################################

On Error Resume Next

Dim worddoc As Word.Document
Dim wordApp As Word.Application

If IsMissing(nekimsflexgrid) Then Exit Sub

If nekimsflexgrid.Rows < 2 Then Exit Sub

Dim i As Long
Dim j As Long
Dim rkraj As Long
Dim kraj As Long
Dim bilajegreska As Long
Dim probasnimi As String

Dim brojace As Long

Dim snimifile As String

Set wordApp = CreateObject("Word.Application")
Set worddoc = wordApp.Documents.Add

On Error GoTo NEKAGRESKA

ActiveDocument.Range.Font.Name = "Arial"
ActiveDocument.Range.Font.Size = 22
ActiveDocument.Range.InsertAfter nekozaglavlje
ActiveDocument.Range.Font.Size = 18
ActiveDocument.Range.InsertAfter Chr(13) & Chr(10)
ActiveDocument.Range.InsertAfter Chr(13) & Chr(10)

ActiveDocument.Range.Font.Size = 12

For i = 1 To nekimsflexgrid.Rows - 1
    For j = 1 To nekimsflexgrid.Cols - 1
            ActiveDocument.Range.InsertAfter nekimsflexgrid.TextMatrix(i, j) & Space(6)
    Next j
            ActiveDocument.Range.InsertAfter vbCrLf
Next i

snimifile = imedokumentazasnimanje & ".doc"

Randomize

If Dir$(file & "\" & snimifile & ".doc") <> "" Then
      probasnimi = snimifile & Int((80 * Rnd) + 1)
      snimifile = snimifile & Int((80 * Rnd) + 1) & ".doc"
End If

If Dir$(file & "\" & snimifile) <> "" Then
If probasnimi = "" Then probasnimi = imedokumentazasnimanje
      snimifile = probasnimi & Int((80 * Rnd) + 1) & ".doc"
End If

ActiveDocument.SaveAs file & "\" & snimifile

ActiveDocument.Close
worddoc.Close
wordApp.Quit
    
    Set wordApp = Nothing
    
    If bilajegreska = 0 Then
        MsgBox "Uspesno uradjeno"
    Else
        MsgBox "Moguca greska prilikom snimanja u WORD"
    End If
    
 Exit Sub
    
NEKAGRESKA:
   
If Err.Number <> 0 Then
    MsgBox "Moguca greska prilokom exporta - - " & Err.Description
End If

bilajegreska = Err.Number

    wordApp.Quit
    Set wordApp = Nothing
    Set worddoc = Nothing
        
End Sub


Re: msflexGrid u Excel 27.02.2004. u 11:18 · pre 276 meseci #3
Mislim da ce s morati da koristis Object Model za Excel ili Word.
Potpis
Blue Man Group
Prijavite se da biste odgovorili u ovoj temi.PrijavaRegistracija

Premeštanje teme