SoftMaker.com

English-Language Support
It is currently Fri May 24, 2013 7:36 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Thu Jun 09, 2011 12:54 pm 
Offline

Joined: Mon May 30, 2011 2:55 pm
Posts: 2
eeehm, well I'm new to VBA though not to programming in general. So I was curious about "how can I test if a variable is actually instantiated or not"
(C: if (NULL==pObjInstance){}).
Maybe the following code-fragment demonstrates more detailed what I'm talking 'bout:
==== snip ====
Code:
Option explicit
Dim tm as object
set tm = CreateObject("TextMaker.Application")
tm.Application.Visible = true

' This works well
If tm.Application.Documents.Count>0 then
   tm.Application.ActiveDocument.Selection.TypeText "god dag alle sammen"
end if

' This doesn't work and returns with "Error in line: xy - Invalid procedure call or argument"
If not(IsEmpty(tm.Application.ActiveDocument)) then
   tm.Application.ActiveDocument.Selection.TypeText "god dag alle sammen"
end if

' And this doesn't work either
If not(IsNull(tm.Application.ActiveDocument)) then
   tm.Application.ActiveDocument.Selection.TypeText "god dag alle sammen"
end if

set tm = nothing

==== snap ====


So the question is: How can I test if a variable exists inside VBA/SoftMaker Basic?


Top
 Profile  
 
PostPosted: Thu Jun 09, 2011 3:23 pm 
Offline
SoftMaker Team
SoftMaker Team

Joined: Wed Apr 09, 2008 7:26 am
Posts: 4550
Location: Nuremberg
Currently there is no function for that. This is on our wish list for future versions.

_________________
Sven Leßmann
SoftMaker Software GmbH


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group