Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > microsoft.public.excel.programming > #110770
| From | GS <gs@v.invalid> |
|---|---|
| Newsgroups | microsoft.public.excel.programming |
| Subject | Re: Problem encountered with Debug.Print message being passed to subroutine |
| Date | 2018-11-07 16:14 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <prvkk5$86r$1@dont-email.me> (permalink) |
| References | (1 earlier) <prtddt$9cs$1@dont-email.me> <2f1dbb63-af9f-4a33-9be7-7b67ac7dcda0@googlegroups.com> <prv928$tra$1@dont-email.me> <prv96h$un5$1@dont-email.me> <821a0ff4-0f70-4155-9b7f-437246d41457@googlegroups.com> |
> On Wednesday, November 7, 2018 at 12:59:49 PM UTC-5, GS wrote:
>>>> On Tuesday, November 6, 2018 at 7:59:45 PM UTC-5, GS wrote:
>>>>>> I have developed a DebugSupport class that gives the option of directing
>>>>>> Debug.Print output to Immediate Window or Immediate Window and disk file
>>>>>> or disk file only. This class has a method output_line. So, in my code
>>>>>> I replace Debug.Print "Line: " & "Test stuff" with
>>>>>> Public dp as New DebugSupport
>>>>>> dp.output_line ("Line: " & "Test stuff")
>>>>>>
>>>>>> This works fine. However if the Debug.Print message contains formatting
>>>>>> functions such as Tab() or Spc(), then I get a compile error i.e.
>>>>>> dp.output_line ("Line: "; Tab(10); "Test stuff") Compile
>>>>>> error
>>>>>>
>>>>>> So, my question is how do I pass such a message into a subroutine.
>>>>>>
>>>>>> The method output_line does two things. It puts the input argument into
>>>>>> a Debug.Print statement and then prints it to disk. I assume that the
>>>>>> Tab() function is specific to Debug.Print and that I would have to
>>>>>> supply some code to replicate this formatting control while printing
>>>>>> to disk. That is not difficult. But I am stumped by the compile error.
>>>>>> Thanks
>>>>>
>>>>> Try constructing the entire string BEFORE passing to your routine so it's
>>>>> already the output string formatted as desired, ..perhaps!
>>>>>
>>>>> -- Garry
>>>>>
>>>>> Free usenet access at http://www.eternal-september.org
>>>>> Classic VB Users Regroup!
>>>>> comp.lang.basic.visual.misc
>>>>> microsoft.public.vb.general.discussion
>>>>
>>>> Actually, I have a more fundamental difficulty
>>>> Debug.Print "A"; Tab(60); "B" ' works properly
>>>> but
>>>> Dim stringa as string
>>>> stringa = "A; Tab(60); B"
>>>> Debug.Print stringa ' gives output: A; Tab(60); B
>>>>
>>>> Is there a way to fix this ?
>>>
>>> sA = "A;" & Tab(60) & "; B"
>>> Debug.Print sA
>>
>> Minus the semicolons...
>>
>> Dim sA$
>> sA = "A" & Tab(60) & "B"
>> Debug.Print sA
>>
>> --
>> Garry
>>
>> Free usenet access at http://www.eternal-september.org
>> Classic VB Users Regroup!
>> comp.lang.basic.visual.misc
>> microsoft.public.vb.general.discussion
>
> I tried your suggestion but still getting a syntax error (Excel 2010) with or
> without the semicolons.
Oops, ..my bad! Try...
Dim s1$
s1 = "A" & vbTab & "B"
Debug.Print s1
-OR-
to set spacing...
Dim s1$
s1 = "A" & Space(60) & "B"
Debug.Print s1
--
Garry
Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
Back to microsoft.public.excel.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Problem encountered with Debug.Print message being passed to subroutine Desmond Walsh <deasmhuinbreathnach@gmail.com> - 2018-11-06 13:43 -0800
Re: Problem encountered with Debug.Print message being passed to subroutine GS <gs@v.invalid> - 2018-11-06 19:59 -0500
Re: Problem encountered with Debug.Print message being passed to subroutine Desmond Walsh <deasmhuinbreathnach@gmail.com> - 2018-11-06 22:53 -0800
Re: Problem encountered with Debug.Print message being passed to subroutine GS <gs@v.invalid> - 2018-11-07 12:57 -0500
Re: Problem encountered with Debug.Print message being passed to subroutine GS <gs@v.invalid> - 2018-11-07 12:59 -0500
Re: Problem encountered with Debug.Print message being passed to subroutine Desmond Walsh <deasmhuinbreathnach@gmail.com> - 2018-11-07 10:40 -0800
Re: Problem encountered with Debug.Print message being passed to subroutine GS <gs@v.invalid> - 2018-11-07 16:14 -0500
Re: Problem encountered with Debug.Print message being passed to subroutine GS <gs@v.invalid> - 2018-11-07 16:54 -0500
Re: Problem encountered with Debug.Print message being passed to subroutine Desmond Walsh <deasmhuinbreathnach@gmail.com> - 2018-11-11 20:23 -0800
Re: Problem encountered with Debug.Print message being passed to subroutine Desmond Walsh <deasmhuinbreathnach@gmail.com> - 2018-11-11 21:09 -0800
Re: Problem encountered with Debug.Print message being passed to subroutine GS <gs@v.invalid> - 2018-11-12 18:10 -0500
Re: Problem encountered with Debug.Print message being passed to subroutine Desmond Walsh <deasmhuinbreathnach@gmail.com> - 2018-11-13 22:36 -0800
Re: Problem encountered with Debug.Print message being passed to subroutine GS <gs@v.invalid> - 2018-11-14 20:31 -0500
csiph-web