Rene vK
Member
- Local time
- Today, 07:03
- Joined
- Mar 3, 2013
- Messages
- 123
I have created a popup and very rigid routine for creating a dossier in MS Word with data from my application. Because creating the file is taking sometime (not extremely) I would like to keep the user entertained. my question, is there a better way to show progress?
Everything works but I would like to 'progress' my skills.
Everything works but I would like to 'progress' my skills.
Code:
Sub createClientdossier(FolderAndFile As String, CDtemplate As String)
'' export code by Steve Bishop
' PrBar = Rectangle, width= 4500 ticks
Dim wDoc As Word.Document
Dim wApp As Word.Application
PrBar.Width = 90 '(2 * 45)
prText = "0%"
Set wApp = New Word.Application
PrBar.Width = 1125 '(25 * 45)
prText = "25%"
Set wDoc = wApp.Documents.Open(CDtemplate)
PrBar.Width = 2250 '(50 * 45)
prText = "50%"
wDoc.Bookmarks("Name").Range.Text = Nz(Klant.Naam, "")
wDoc.Bookmarks("Adres").Range.Text = Nz(Klant.Adres, "")
wDoc.Bookmarks("City").Range.Text = Nz(Klant.Postcode & " " & Klant.Plaats, "")
wDoc.Bookmarks("DateOfBirth").Range.Text = Nz(Klant.GeboorteDatum, "")
wDoc.SaveAs2 FolderAndFile
wDoc.Bookmarks("Name").Range.Delete wdCharacter, Len(Nz(Klant.Naam, ""))
wDoc.Bookmarks("Adres").Range.Delete wdCharacter, Len(Nz(Klant.Adres, ""))
wDoc.Bookmarks("City").Range.Delete wdCharacter, Len(Nz(Klant.Postcode & " " & Klant.Plaats, ""))
wDoc.Bookmarks("DateOfBirth").Range.Delete wdCharacter, Len(Nz(Klant.GeboorteDatum, ""))
PrBar.Width = 4500 '(100 * 45)
prText = "100%"
wDoc.Close False
wApp.Quit
Set wDoc = Nothing
Set wApp = Nothing
Forms![MainScreen].MakeList (Klant.Folder)
DoCmd.Hourglass (False)
DoCmd.Close acForm, "Dossier"
End Sub