Tampilkan postingan dengan label visual basic. Tampilkan semua postingan
Tampilkan postingan dengan label visual basic. Tampilkan semua postingan

Rabu, 08 Oktober 2008

Creating an Automatic Saving Program in New Document of Microsoft Word

Creating a new document is an activity simply. But we sometime forget to saving it. So this article helps us to saving the document automatically.

When you click File New or Ctrl+N the dialog will seen like :


After it you give a file name, for example Fitri:



Like last article, We use Visual Basic Editor fasility. Follow the steps behind:
You click Tools => Macro => Visual Basic Editor or enter keyboard together (ALT+F10) so will dialog visual basic editor. After that step is done, then right click project


then copy this code into place of source code:
------------------

'Tips dan Trik Visual Basic Editor
'CopyLeft by Sutrisno
'http://trisnowlaharwetan.net

Sub AddName()
On Error Resume Next
Dim NamaFile
NamaFile = InputBox("Enter File Name", "Trisno's Project")
If NamaFile = "" Then Exit Sub
Documents.Add
ActiveDocument.SaveAs FileName:=NamaFile
End Sub

Sub FileNew()
Call AddName
End Sub

------------------

Good luck...
 
Indonesian Edition