PDA

View Full Version : [SOLVED:] VBA Print function - want quotation marks in my text file



Meat_Pie_200
09-11-2013, 09:53 AM
Hi,

I am using VBA to write a macro which will be used by a specialist piece of engineering software. One of the lines I want in my coding is this:


~"mf%x% %ms999_8%

I am using the print function so my code looks like this:


Print #1, "~"mf%x% %ms999_8%"

However, VBA is not happy with this, presumably as it creates a text line with just ~ in it and then trips up when trying to read the mf%x% bit.

Does anybody know of a way around this?

Thanks.

JKwan
09-11-2013, 12:13 PM
Is this what you mean?


Sub test()
Const cQuote As String = """"
MsgBox "~" & cQuote & "mf%x% %ms999_8%"

End Sub

Meat_Pie_200
09-11-2013, 12:24 PM
Is this what you mean?


Sub test()
Const cQuote As String = """"
MsgBox "~" & cQuote & "mf%x% %ms999_8%"

End Sub


Cheers JKwan!

I think you have cracked it. I need to adjust the code slightly I think but that seems to be the way forward to me.

I'll try it in the morning when I am back at work and let you know how I get on.

James.

mancubus
09-12-2013, 04:07 AM
without a constant or variable...
MsgBox "~""mf%x% %ms999_8%"

snb
09-12-2013, 04:50 AM
or


"~" & chr(34) &"mf%x% %ms999_8%"