Greetings,
I have a small spreadsheet that I export to a text file to run DNSCmd entries.
I use (plagiarized from someone else because of lack of knowledge)...
Sub createConfig()
Application.ScreenUpdating = False
' Determine where to dave the config file
configFile = Range("save_location").Value & Range("saved_file_name")
' Open the file for output
fnum = FreeFile()
Open configFile For Output As fnum
' Determine which config sheet to export
Dim configType As String
configType = "DNS"
' Now go to that config sheet and get the data and dump to file
Sheets(configType).Select
lastRow = Range("D40").End(xlUp).Row
Range("D16").Select
Do While ActiveCell.Row <= lastRow
output = ActiveCell.Value
Print #fnum, output
ActiveCell.Offset(1, 0).Select
Loop
' Close the file
Close #fnum
Sheets("DNS").Select
Application.ScreenUpdating = True
SaveMsg = "DNS Configuration file saved to " & configFile & vbNewLine & vbNewLine
MsgBox Prompt:=SaveMsg, Title:="Configuration Compilation Complete"
End Sub
This works fine, however my output contains (potentially) blank lines as shown below...
DnsCmd dc1ns-ad01.hc.int RecordAdd hc.int MNTESTRT01 /CreatePTR A 10.192.1.1
DnsCmd dc1ns-ad01.hc.int RecordAdd hc.int MNTESTRT01-CE /CreatePTR A 10.190.1.45
DnsCmd dc1ns-ad01.hc.int RecordAdd hc.int MNTESTRT01-PE /CreatePTR A 10.190.1.46
DnsCmd dc1ns-ad01.hc.int RecordAdd hc.int MNTESTRT01-VLAN1 /CreatePTR A 10.1.1.254
DnsCmd dc1ns-ad01.hc.int RecordAdd hc.int MNTESTRT01-VLAN2 /CreatePTR A 10.1.2.254
DnsCmd dc1ns-ad01.hc.int RecordAdd hc.int MNTESTRT01-VLAN3 /CreatePTR A 10.1.3.254
DnsCmd dc1ns-ad01.hc.int RecordAdd hc.int MNTESTRT01-VLAN4 /CreatePTR A 10.1.4.254
DnsCmd dc1ns-ad01.hc.int RecordAdd hc.int MNTESTRT01-VLAN1-HSRP /CreatePTR A 10.1.1.254
DnsCmd dc1ns-ad01.hc.int RecordAdd hc.int MNTESTRT01-VLAN2-HSRP /CreatePTR A 10.1.2.254
DnsCmd dc1ns-ad01.hc.int RecordAdd hc.int MNTESTRT01-VLAN3-HSRP /CreatePTR A 10.1.3.254
DnsCmd dc1ns-ad01.hc.int RecordAdd hc.int MNTESTRT01-VLAN4-HSRP /CreatePTR A 10.1.4.254
DnsCmd dc1ns-ad01.hc.int RecordAdd hc.int MNTESTRT02-VLAN1-HSRP /CreatePTR A 10.1.1.253
DnsCmd dc1ns-ad01.hc.int RecordAdd hc.int MNTESTRT02-VLAN2-HSRP /CreatePTR A 10.1.2.253
DnsCmd dc1ns-ad01.hc.int RecordAdd hc.int MNTESTRT02-VLAN3-HSRP /CreatePTR A 10.1.3.253
DnsCmd dc1ns-ad01.hc.int RecordAdd hc.int MNTESTRT02-VLAN4-HSRP /CreatePTR A 10.1.4.253
DnsCmd dc1ns-ad01.hc.int RecordAdd hc.int MNTESTSW01 /CreatePTR A 10.1.1.240
DnsCmd dc1ns-ad01.hc.int RecordAdd hc.int MNTESTSW02 /CreatePTR A 10.1.1.241
DnsCmd dc1ns-ad01.hc.int RecordAdd hc.int MNTESTSW03 /CreatePTR A 10.1.1.242
DnsCmd dc1ns-ad01.hc.int RecordAdd hc.int MNTESTSW04 /CreatePTR A 10.1.1.243
Q: Is there a simple modification to what I have above to remove the blank lines?
Thanks in advance. Heaps...
ReeceB
Bookmarks