-1

i'm trying with the code above save manually an another workbook (different of that the code is write). But... It doens't work. The command sendkeys just works on the properly worbook

Workbooks("prorrogacao automatica.csv").Sheets("prorrogacao automatica").Application.SendKeys "^b"

please, considering i need to use this way to save.

braX
  • 11,506
  • 5
  • 20
  • 33
  • 1
    Does this answer your question? [Saving Existing Excel sheet](https://stackoverflow.com/questions/7890380/saving-existing-excel-sheet) – Storax May 29 '21 at 07:31

1 Answers1

0

SendKeys should only be used as a last resort.

It looks like you are just trying to make the currently selected item bold, right?

You should be able to do that like this:

Selection.Font.Bold = Not Selection.Font.Bold

i need to use this way to save.

Nothing in your code is doing any saving... and you don't need SendKeys to save it either. Maybe your question needs some more clarification?

braX
  • 11,506
  • 5
  • 20
  • 33
  • I think you might have got it wrong because `Ctrl-B` is probaly the keyboard shortcut in Portugese for save :-) – Storax May 29 '21 at 07:30
  • 1
    I guess that just illustrates why `SendKeys` is not a good solution. – braX May 29 '21 at 14:28
  • Yes, in "my" german version `CTRL+b` does not seem to have any function and it is not the shortcut for bold because that is `CTRL-SHIFT+f`. – Storax May 29 '21 at 15:34
  • Lol i'm sorry, but the matter is... i'm brazil we save by hotkey using ctrl b... and i can't save using the usually vba way because the workbook is a format csv and if i do automatic by vba, the extension (.csv) changes. I tried a lot of different things (also save as =XLCSV) so i need to simulate a manual save. by the way, i though using a send key ctrl b (Brazilian save) but how the code is written on another table, it uses the save in its own and no on the csv file. – Pedro Pacheco May 29 '21 at 17:21
  • 1
    Ok, you are Brazil but you don't speak brazilian, do you? LOL! BTW, what you wrote in your comment (_the workbook is a format csv ..._) you should add to your post because that is important information. And a more concise description of what you did and what you want to achieve would also be most helpful. You do not need to "sendkeys" `Ctrl-b` that's for sure. – Storax May 29 '21 at 17:53
  • Your question should probably be something along the lines of "how can I use VBA to export a CSV file" - but you can also find many examples of this just be searching for those terms. Good luck. – braX May 29 '21 at 18:02