VBA - save file as...

Read_This

New Member
Joined
Aug 13, 2014
Messages
37
In vba I'm trying to save a copied portion of an xlsm worksheet C1:C466 as a test.ebm file.

For reference, an .ebm file [when opened in notepad] appears as normal text, no special characters or issue however, my problem is forcing vba to save, naming with the .ebm file extension. [In Windows, this can be achieved by pasting the copy into a notepad file and saving that file in quotes e.g. "Test.ebm"


Perfection would be to save the .ebm file in C:\Users\Public\Documents

A "Save as" with a prompt will also ok however, ideally I would like all the above



Any support/pointers would be appreciated
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Code:
Sub test()
Dim c As Range
Open "C:\Users\Public\Documents\test.ebm" For Output As [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1]#1[/URL] 
For Each c In Range("C1:C466")
    Print [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1]#1[/URL] , c.Text
Next
Close [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1]#1[/URL] 
End Sub
 
Upvote 0
Code:
Sub test()
Dim c As Range
Open "C:\Users\Public\Documents\test.ebm" For Output As [URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1"]#1[/URL] 
For Each c In Range("C1:C466")
    Print [URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1"]#1[/URL] , c.Text
Next
Close [URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1"]#1[/URL] 
End Sub

Perfect - thank you!
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,157
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top