Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Opening Notepad from Excel

I am trying to write a VBA code that does the following:
1. open Notepad from inside Excel
2. Save a blank file (i.e, Save as Test.kml)
3. Close the Notepad
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Opening Notepad from Excel


You don't need to run notepad. Just create the file and close it.

Const ForReading = 1, ForWriting = -2, _
ForAppending = 3

WriteFile = "c:\temp\Test.kml"
Set fs = CreateObject("Scripting.FileSystemObject")
Set fout = fs.CreateTextFile _
(Filename:=WriteFile, overwrite:=True)

fout.Close


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=149280

  #3   Report Post  
Posted to microsoft.public.excel.programming
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Opening Notepad from Excel

Thanks

"joel" wrote:


You don't need to run notepad. Just create the file and close it.

Const ForReading = 1, ForWriting = -2, _
ForAppending = 3

WriteFile = "c:\temp\Test.kml"
Set fs = CreateObject("Scripting.FileSystemObject")
Set fout = fs.CreateTextFile _
(Filename:=WriteFile, overwrite:=True)

fout.Close


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=149280

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Opening Notepad from Excel

You want a 0 byte file?

Option Explicit
Sub testme()

Open "C:\Test.kml" For Output As 1
Close #1

End Sub

Be careful with this. If that file exists, then it's emptied. If it doesn't
exist, it'll be created.

(Change the path to what you want.)



Ayo wrote:

I am trying to write a VBA code that does the following:
1. open Notepad from inside Excel
2. Save a blank file (i.e, Save as Test.kml)
3. Close the Notepad


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Opening Notepad from Excel

Thanks

"Dave Peterson" wrote:

You want a 0 byte file?

Option Explicit
Sub testme()

Open "C:\Test.kml" For Output As 1
Close #1

End Sub

Be careful with this. If that file exists, then it's emptied. If it doesn't
exist, it'll be created.

(Change the path to what you want.)



Ayo wrote:

I am trying to write a VBA code that does the following:
1. open Notepad from inside Excel
2. Save a blank file (i.e, Save as Test.kml)
3. Close the Notepad


--

Dave Peterson
.



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
Opening notepad file then sending to back DJ MC Excel Programming 3 August 15th 07 06:40 PM
Opening & Reading file in notepad then pasting into excel using VB DJ MC Excel Programming 2 July 31st 07 10:31 AM
Opening Notepad application from Excel macro Rafael Excel Programming 5 October 9th 06 03:09 PM
Opening Notepad from Code Stan Excel Programming 3 July 16th 04 03:18 PM
opening and writing into notepad peter Excel Programming 1 August 15th 03 07:09 PM


All times are GMT +1. The time now is 01:32 AM.

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

About Us

"It's about Microsoft Excel"