snipt

Ctrl+h for KB shortcuts

VB.net

VBScript – Open Word Document

1
2
3
4
5
6
7
8
Set WordObj = CreateObject("Word.Application")
'WordObj.Visible = False

Set WordDocument = WordObj.Documents.Open(pfad)

'WordDocument.PrintOut()
WordDocument.Close()
WordObj.Quit()
https://snipt.net/embed/a66416a2c575d5fceed56221e1cce054/
https://snipt.net/raw/a66416a2c575d5fceed56221e1cce054/
a66416a2c575d5fceed56221e1cce054
vb.net
VB.net
8
2016-09-24T12:34:10
True
False
False
/api/public/snipt/49228/
vb-open-word-document
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="k">Set</span> <span class="n">WordObj</span> <span class="o">=</span> <span class="n">CreateObject</span><span class="p">(</span><span class="s">&quot;Word.Application&quot;</span><span class="p">)</span> </span><span id="L-2"><a name="L-2"></a><span class="c">&#39;WordObj.Visible = False</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="k">Set</span> <span class="n">WordDocument</span> <span class="o">=</span> <span class="n">WordObj</span><span class="p">.</span><span class="n">Documents</span><span class="p">.</span><span class="n">Open</span><span class="p">(</span><span class="n">pfad</span><span class="p">)</span> </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a><span class="c">&#39;WordDocument.PrintOut()</span> </span><span id="L-7"><a name="L-7"></a><span class="n">WordDocument</span><span class="p">.</span><span class="n">Close</span><span class="p">()</span> </span><span id="L-8"><a name="L-8"></a><span class="n">WordObj</span><span class="p">.</span><span class="n">Quit</span><span class="p">()</span> </span></pre></div> </td></tr></table>
vbs, word

VB.net

Crea un archivo de texto

1
2
3
4
5
6
7
'henrytejera@gmail.com - VBScript
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objTS = objFS.CreateTextFile("C:\archivo.txt") 
objTS.Write("Línea 1")
objTS.WriteBlankLines(1)
objTS.Write("Línea 2")
objTS.Close
https://snipt.net/embed/ea97d24024c7b7c8e559e2c40787a8b3/
https://snipt.net/raw/ea97d24024c7b7c8e559e2c40787a8b3/
ea97d24024c7b7c8e559e2c40787a8b3
vb.net
VB.net
7
2016-09-23T00:56:36
True
False
False
/api/public/snipt/1290/
crea-un-archivo-de-texto
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="c">&#39;henrytejera@gmail.com - VBScript</span> </span><span id="L-2"><a name="L-2"></a><span class="k">Set</span> <span class="n">objFS</span> <span class="o">=</span> <span class="n">CreateObject</span><span class="p">(</span><span class="s">&quot;Scripting.FileSystemObject&quot;</span><span class="p">)</span> </span><span id="L-3"><a name="L-3"></a><span class="k">Set</span> <span class="n">objTS</span> <span class="o">=</span> <span class="n">objFS</span><span class="p">.</span><span class="n">CreateTextFile</span><span class="p">(</span><span class="s">&quot;C:\archivo.txt&quot;</span><span class="p">)</span> </span><span id="L-4"><a name="L-4"></a><span class="n">objTS</span><span class="p">.</span><span class="n">Write</span><span class="p">(</span><span class="s">&quot;Línea 1&quot;</span><span class="p">)</span> </span><span id="L-5"><a name="L-5"></a><span class="n">objTS</span><span class="p">.</span><span class="n">WriteBlankLines</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> </span><span id="L-6"><a name="L-6"></a><span class="n">objTS</span><span class="p">.</span><span class="n">Write</span><span class="p">(</span><span class="s">&quot;Línea 2&quot;</span><span class="p">)</span> </span><span id="L-7"><a name="L-7"></a><span class="n">objTS</span><span class="p">.</span><span class="n">Close</span> </span></pre></div> </td></tr></table>
vbs
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.